listing files in a directory folder and subfolders and copy

Björnke von Gierke bvg at mac.com
Tue Dec 2 10:50:02 EST 2003


You need to make a directory walker. You have to loop trough all the 
folders and set the defaultfolder to it, then loop trough these folders 
etc. Watch out for the .. directory on macosx and unix systems, it 
might trap you in a infinite loop.

for example:
--WARNING script untested
on lookateachfolder thefolder --thefolder is a path
   set the defaultfolder to thefolder
   repeat for each line theLine in the folders
     if char one of theLine <> "." then
       set the defaultfolder to theLine
       --do your file listing here using "the files"
       lookateachfolder (the defaultfolder & "/" & theLine) --for 
folders in this folder
     end if
   end repeat
end lookateachfolder

On Dienstag, Dez 2, 2003, at 13:31 Europe/Zurich, Bob Hartley wrote:

> Hi all
>
> I am new to revolution. I have been impressed by the demo and after 5 
> days decided to buy it. :-))))
>
> I'm creating an app for our office to copy files from one directory to 
> another. "I" normally use total commander for this on windows, but my 
> colleagues are still insistent on explorer. Doh!!!!
>
> The app I want to create is simple. It should be able to browse to a 
> directory folder and list all files in the folder and subfolders that 
> have the .pic extension. E.g. clicking on the  "find folder" button in 
> the schematic below will open the windows browse template and a 
> colleague can navigate to their folder and by clicking OK it will list 
> the paths to those files.
>
> eg R:\medical\dave\images
> or R:\medical\bobsstuff\
> However the folder "images will have 20 folders in it and the .pic 
> files will be in these. IE. It needs to list all the .pic files in the 
> sub-folders.
>
> Then clicking on the "put in this folder"; all the files listed will 
> be copied to the destination folder
>
>
> It will look like this
> ##############################################
>
> get image files from this directory
>
> ///////////////
> find folder                     this is a box
> //////////////
>
> ////////////////////////
> put in this folder              another box
> ////////////////////////
>
> ////////////
> COPY
> ///////////
>
> I checked the help files and can see how to list a files and folders 
> in one directory. OK so far but to list all in the subfolders is not 
> clear to me.
>
> Thanks for the help and bearing with a newbie.
>
>
> Cheers
> Bob
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the Use-livecode mailing list