File Walker

JB sundown at pacifier.com
Mon Sep 29 13:10:18 EDT 2014


Here is a link for a file and folder lister
that uses recursive.

http://lessons.runrev.com/m/4071/l/17080-files-and-folders-part-2

It appears recursive is limited to 400,000.

As for the File Walker link I tried it in one of
my folders that has a lot of files and subfolders
and it did not work for me but it did in other
folders.

If you get one that works please post it.

John Balgenorth



On Sep 29, 2014, at 8:59 AM, Bob Sneidar <bobsneidar at iotecdigital.com> wrote:

> Hi all. 
> 
> I remember reading in a post that someone had made a stack that would walk through a file folder and enumerate all the files and folders. I cannot for the life of me find it in the Livecode Share site or the forums. I cannot search for “list files” or “find all files” because the forum search complains the words I am searching for are too simple! <GAAAHHH!>
> 
> I have written a command to do it and it works up through the files in the first folder it finds, but when it comes to going back to a prior recursion it does not seem to work. Here is the handler:
> 
> on enumerateFilesAndFolders theCurrentPath, @theCurrentList
>   set the defaultFolder to theCurrentPath
>   put the files into theCurrentFileList
>   put the folders into theCurrentFolderList
>   put theCurrentFileList & theCurrentFolderList into theCurrentFilesAndFolders
>   filter theCurrentFilesAndFolders without ".*"
>   sort theCurrentFilesAndFolders Ascending
> 
>   repeat for each line theCurrentLine in theCurrentFilesAndFolders
>      put theCurrentPath & "/" & theCurrentLine into thePath
> 
>      if there is a file thePath then
>         put thePath & cr after theCurrentList
>      else if there is a folder thePath then
>         put thePath & “/“ & cr after theCurrentList
>         put thePath into theCurrentPath
>         enumerateFilesAndFolders theCurrentPath, theCurrentList
>      end if
>   end repeat
> end enumerateFilesAndFolders
> 
> It seems after the recent iteration is finished, the value of theCurrentPath is not reverting to the version of the prior iteration instance. In other words, it seems to be global to all instances of the iterations of the handler. I was under the distinct impression that each iteration had it’s own copies of a given variable because of the implicit scoping used by Livecode. Apparently I am mistaken. 
> 
> I would like to see how anyone else has done a file walker. 
> 
> Bob S
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list