afind: find files with wildcards usage: afind [filter] [-neg_filter] parameters filter: file mask in the usual form, like "*.txt" Parameters: -neg_filter: mask starting with a minus sign, files matching this mask will be skipped, like "-*.o" -d {dirname}: directories with this mask will be skipped -root {startdir}: staring directory for the search -ar: the root directory is added to the file names -sp: put spaces between the file names instead of newlines -maxdepth: max depth in the directory tree, 0: search only in the starting dir -ld: list dirs, that is every subdiectory that was scanned -is: immediate show. By default, the files are printed only after the searching finished. With this option the file names are printed immediately after the file has been found. -sd: show dirs. The scanned directories are listed as the progress goes on (in same line). This can be useful in following the serach process in case of deep structures and many files. -find {text}: list only files that contain the given text to the starting directory -ct: check times, only the files will be printed that correspond to the following parameters -fm {file_mode}: specifies which property of the file must be used valid values: c[creation], m[odification] (default), a[ccess] -st[art]: specifies the start of the time range -end: end of the time range -tm {mode}: specifies the way the time range is used 0/internal: files within the interval (default) 1/external: files outside of the interval 2/after: files after the start time (end is not necessary) (default) 3/before: files before the end time (start -"- ) -e {expr}: use the 'exp' runtime expression to filter files. The options defines the following variables: - fn/filename: the file name with path - fname: filename without path and extension - ext: extension (without dot) - dir: the path of the file - depth: the integer value of the depth of the current file - mtime: the modification time of the file (in YYYY.MM.DD:HH:MM:SS format) - mtime_date: only the date part of the file modification (YYYY.MM.DD) - mtime_time: the time part of -"- (HH:MM:SS) The expression gives an integer value: if zero, the file is skipped, otherwise the file is part of the result set. -pd: print the differences between files. That is print the files that don't have a corresponding one in the other directory. This parameter requires two filters (like "src/*" and "dst/*") -pc: print the files that have corresponding ones in the other directory. Both names will be printed, the one on the first path and the other one on the second path (in two lines). -v {var.def.}: define a runtime variable -q[uiet] {expr}: evaluate the expression before the evaluation of the search expression. The time values are of the following format: YYYY.MM.DD:HH:MM:SS (2010.04.21:10.22:30) The values can be omitted starting from the right. The omitted values evaluate to zero (2010.04.11 means the begin of that day) There are aliases for certain days (beginnigs), too: - TODAY - YESTERDAY - 2_DAYS_AGO (3...6) - 1_WEEK_AGO (2..4) These aliases can be extended with normal time values, too: - TODAY:10:25 Other parameters are treated as file names A wildcard with path gives full file names, other ones are relative to the current directory. Examples: afind "*.*" -*.obj -> find any file (with extension) except the object files afind "*.txt" -find Joe -> find any text file containing 'Joe' afind "/tmp/*.txt" -> find every text file from the temp dir, the resulting file names will be like: "/tmp/apple.txt" (contain the path of the search criteria) afind "*.txt" -root work/text -> result is like: "a.txt" (relative to work/text) afind "*.txt" -root work/text -ar -> work/text/a.txt etc (relative to cur dir) afind "*.txt" -ct -start 2010.04.21:10:00 -tm after -> find every text file that were modified since the given date afind "*.txt" -ct -start 2010.03.01 -end 2010.03.31 -fm c -> find every text file that were cretated in March, 2010 afind "*.txt" -ct -start TODAY:10:30 -fm modification -tm after -> find every text file that have been edited today, after half past ten afind -e "strcont(fn, 'apple') || strcont(fn, 'plum')" -> find each file where the entire file name (with path) contains a fruit name The following expression is equivalent to the previous one: "fn []= 'apple' || fn []= 'plum'" (this uses the '[]=' - string containment - operator) afind "src/*" "dst/*" -pd -> print the files of "src" that don't have a corresponding one (same name and subdir) in "dst". If "src" contains "sub/apple.txt" and there is no such file in "dst" ("dst/sub/apple.txt"), it will be printed. afind -e "mtime_date == '2011.10.22'" -> find only the file that were modified on the given day afind -e "time_cmp(mtime, '2011.10.22:12:00')" -> find the files that were modified after noon on the given date afind "*.txt" -v "size" -q "size = get_file_size(fn)" -e "(size > 100 && size < 300) || (size > 1000 && size < 2000)" -> find the text files whose size is within either of the given ranges This example shows how to make it easier to use the same value several time in the expression with better readability (and performance, depending on the structure of the expression - see the next example). afind "*.*" -v "e" -q "e = strlower(ext)" -e "e=='txt' || e=='cpp' || e=='c' || e=='hpp' || e=='h' || e=='pas' || e=='asm'" -> in this case we don't have to evaluate the 'strlower(ext)' expression several times (and the same applies to the typing)