Documention for: scan-dir.r Created by: henrik on: 12-Oct-2007 Last updated by: henrik on: 27-Nov-2007 Format: text/editable Downloaded on: 19-Apr-2024 ===Introduction SCAN-DIR scans the given directory recursively and returns all files in it to the console with the relative path on each file. You can match files and perform callbacks on each file. \note This function can be very time consuming, if you use it on the root of your disk. /note ===Examples A plain recursive read of the given directory: >> scan-dir %./ == [... recursive list of files ...] This returns each file with the path relative to the given directory. >> scan-dir/absolute %./ == [... recursive list of files with absolute path ...] This returns each file with absolute path instead of relative to the given directory. ---File Matching Matching specific files in the list: >> scan-dir/match %./ ".r" == [... recursive list of files ...] This will match all files that have ".r" in the name and exclude everything else. You can match files listed in strings, blocks and straight as files. So if you have a list of .r and .txt files, you want to act on, you can do it like this: >> scan-dir/match %./ [".r" ".txt"] == [... recursive list of files ...] You can also mix types: >> scan-dir/match %./ [".r" %test.txt [".txt" ".bin"]] == [... recursive list of files ...] ---Callback When using the callback function, you give the current file as argument to the function. >> scan-dir/callback %./ func [f] [print size? f] This prints the size of each single file. You can also mix /callback and /match. Enjoy!