Getting Directory Tree
Till Bandi
tbandi at swissonline.ch
Wed Feb 2 15:44:49 EST 2005
Rinaldi's Site is:
http://rinaldicollection.free.fr/
Till
Am 02.02.2005 um 20:19 schrieb Alex Tweedly:
> Derek Bump wrote:
>
>> I'm at a loss. I've spent the last 3 hours trying to make a script
>> that will look at 1 directory and provide a complete hierarchial list
>> of all files within all folders and subfolders, and I can't make it
>> work.
>>
>> Has anyone else attempted this, and been successful?
>>
> Courtesy of Frederic Rinaldi's "filter demo" - his site is off-line,
> or moved and I can't find it, so here's the script below
> .... beware line wrap (and French error messages !)
> ..... beware - it automatically filters a couple of kinds of files -
> check if those are suitable for you
>
>> function AllFiles theFolder,addFullPath,allInfos
>> --returns full path of all enclosed files
>> local startFolder
>> set cursor to busy
>> if last char of theFolder is not "/"
>> then put "/" after theFolder
>> if startFolder is empty
>> then put theFolder into startFolder
>> set the defaultFolder to theFolder
>> if the result is not empty
>> then
>> beep
>> answer error "Répertoire inexistant:" & return & return &
>> theFolder titled "Erreur"
>> exit to top
>> end if
>> put the detailed files into filesList
>> filter filesList without ".*"
>> filter filesList without "Icon%0D*"
>> filter filesList without "*,MACSfdrp" -- remove folder aliases
>> put the folders into foldersList
>> filter foldersList without ".*"
>> repeat for each line loopFolder in foldersList
>> put AllFiles(thefolder & loopFolder & "/",addFullPath,allInfos) &
>> return after resultList
>> end repeat
>> repeat with i=number of lines of filesList down to 1
>> set cursor to busy
>> if addFullPath
>> then put MyURLEncode(theFolder) before line i of filesList
>> if allInfos = false
>> then put item 1 of line i of filesList into line i of filesList
>> end repeat
>> get resultList & filesList
>> sort lines of it
>> return word 1 to -1 of it -- strip empty lines
>> end AllFiles
>>
>> function MyURLEncode what
>> put URLEncode(what) into what
>> replace "%2F" with "/" in what
>> return what
>> end MyURLEncode
>
> -- Alex.
More information about the use-livecode
mailing list