Tcl
|
This Tcl script provides a procedure that recursively
checks the sizes of files in a directory. The full paths
of those files that are larger than a specified size are
appended to a list supplied by the user. The procedure
uses recursion to examine the directory structure of the
target directory. |
The input parameters are: getFiles dir the full path of the target directory sizelimit files larger than this size will be appended to the files list files the string to which file names will be appened Example: A directory called "CV" contains 10 files of various sizes. The directory is located at "/Users/Documents/CV" To get a listing of all files in this directory that exceed 32Kb the getFiles procedure might be used by another Tcl script as follows. source /Users/Documents/TCL/getFiles.tcl # print the files to the console set maxsize 32000 set files "" getFiles "/Users/Documents/CV" $maxsize files puts $files Note the use of the source command to "point" the Tcl interpreter at the directory containing the getFiles.tcl script. |
© 2002- Malcolm Kesson. All rights reserved.