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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode