Re: [Gambas-user] Please help with directory problem
On Sat, Nov 1, 2008 at 9:19 AM, Doriano Blengino [EMAIL PROTECTED] wrote: Kari Laine ha scritto: Anyway, why don't you use a simpler mkdir -p ? I didn't remember it ? Thanks I read your other subsequent message too, about the error, and noticed you solved. So, you *can* work out by gambas code, and your task is done. This is not a gambas suggestion, but in the end a mkdir -p is cleaner, easier, and faster... Right after a mkdir -p ... you can test for the directory existance, to see if all went well. Best Regards Kari Laine - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Please help with directory problem
On Friday 31 October 2008, Kari Laine wrote: On Fri, Oct 31, 2008 at 11:52 PM, Kari Laine [EMAIL PROTECTED] wrote: On Fri, Oct 31, 2008 at 2:57 PM, Benoit Minisini [EMAIL PROTECTED] wrote: On vendredi 31 octobre 2008, Kari Laine wrote: Thanks Benoit ! I often forget the WAIT keyword after a SHELL or EXEC command, so now I think this syntax was not a really good idea. I should have used the opposite syntax, i.e. a keyword like BACKGROUND or DO NOT WAIT! Hi, I still have a problem. The routine is now following PUBLIC SUB makedirs(sHak AS String) DIM haks AS NEW String[300] DIM hak2 AS String DIM crtdir AS String crtdir = /home/kari/backup_work/cdroot/ haks = Split(sHak, /) FOR EACH hak2 IN haks IF hak2 = THEN CONTINUE crtdir = crtdir / hak2 'SHELL mkdircrtdir 'TRY MKDIR crtdir SHELL mkdircrtdir WAIT 'PRINT crtdir NEXT END When I'm see it right you are creating a sequence of dirs crtdir = /home/kari/backup_work/cdroot/ sHak=my/nice/path/to/files you could do a SHELL mkdir -p crtdir / sHak WAIT -- for mkdir there are two ways to create: 1) 'mkdir my nice path to files' this will create all given dirs in the current working directory. /home/kari/backup_work/cdroot/my /home/kari/backup_work/cdroot/nice /home/kari/backup_work/cdroot/path ... 2) 'mkdir my/nice/path/to/files' this will create the whole path in one go /home/kari/backup_work/cdroot/my/nice/path/to/files Using the -p option prevent errors if the directory already exists. Best regards Ron_1st -- A: Delete the text you reply on. Q: What to do to get my post on top? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Please help with directory problem
On vendredi 31 octobre 2008, Kari Laine wrote: Thanks Benoit ! I often forget the WAIT keyword after a SHELL or EXEC command, so now I think this syntax was not a really good idea. I should have used the opposite syntax, i.e. a keyword like BACKGROUND or DO NOT WAIT! -- Benoit Minisini - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Please help with directory problem
You could try defining a integer variable to keep track of your array Here is your code with a slight modification... not tested... but try it PUBLIC SUB Button2_Click() DIM sHak AS String DIM haks AS NEW String[300] DIM hak2 AS String DIM crtdir AS String DIM i as Integer sHak = /home/kari/ulkoiset/sdi1/debian_src/ ftp.fi.debian.org/debian/pool/main/g/gimp/ crtdir = /home/kari/backup_work/cdroot/ haks = Split(sHak, /) ' FOR EACH hak2 IN haks FOR i = 0 to Haks.Count - 1 ' crtdir = crtdir / hak2 crtdir = crtdir / haks[i] PRINT crtdir SHELL mkdircrtdir 'PRINT hak2 'PRINT crtdir NEXT END See if that works On Thu, Oct 30, 2008 at 3:24 PM, Kari Laine [EMAIL PROTECTED] wrote: Hi All, still making my homebrew backup-program. Now I have tried to get a simple thing to work for something like 5 hours. Following is a test routine which does not work. It's idea is to create directory structure given in variable SHak inside directory given by variable crtdir. Any ideas why it does not work? I remember seeing something in help about directories in Gambas but I think that should not affect absolute paths... PUBLIC SUB Button2_Click() DIM sHak AS String DIM haks AS NEW String[300] DIM hak2 AS String DIM crtdir AS String sHak = /home/kari/ulkoiset/sdi1/debian_src/ ftp.fi.debian.org/debian/pool/main/g/gimp/ crtdir = /home/kari/backup_work/cdroot/ haks = Split(sHak, /) FOR EACH hak2 IN haks crtdir = crtdir / hak2 PRINT crtdir SHELL mkdircrtdir 'PRINT hak2 'PRINT crtdir NEXT END Best Regards Kari Laine - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user