Project

General

Profile

Actions

Useful filename functions

  • Return a list with all files and sub-folders (recursively) from a given folder
    listcat is a function defined in "locked/lib/_mlistlib.pkg". This package must be loaded before use this snippet.
    At the beginning, the second argument, out, should be at nil.
fun getFilesInFolder (rep, out)=
    if rep == nil then
        out
    else
        let _listofsubdir hd rep -> reps in
        let _listoffiles hd rep -> files in
        (
        if reps != nil then set out = listcat getFilesInFolder reps nil out else nil;
        set out = listcat files out;
        getFilesInFolder tl rep out
        );;

Author : iri
Date : december 2011

Return to Examples

Updated by iri almost 13 years ago ยท 1 revisions