The daymvdel application will delete or move files or entire directory trees based on file age in days. Any mention of QNX in this document refers to the QNX 4.x OS.
This application uses the directory tree removal, directory scanning and path parsing API's.
The daymvdel application can be compiled on any stated platform. Under the Linux/Unix/QNX/FreeBSD operating systems, daymvdel can be compiled using the mkdaymvdel script.
The daymvdel application has the following command line syntax:
daymvdel [-q] [-l[ log_file]] [-n] [-c] task_list_file
Where 'task_list_file' is a ASCII file containing a list of directories and what to do in each directory. The task list is in the following format for a delete operation:
d[s][a] numdays fname source_path
The task list is in the following format for the move operation:
m[s][a] numdays fname source_path dest_path
The first option is an m for move or d for delete. One of these two must be present. The option s includes subdirectories and the option a stands for all or nothing which means move or delete all files as long as every file meets the age requirement. If any file does not meet this requirement, delete or move none of the files.
The parameter numdays is the file age in days, fname indicates which files to consider (the wildcards * and ? may be used), source_path is source directory path and dest_path (required only for a move operation) is the destination directory path.
Any task line parameter that contains spaces must be quoted.
In addition to the normal move or delete operation, you can apply the tree command that will perform the move or delete operation to each subdirectory underneath the specified tree. The task list line syntax along with the tree command is:
td[s][a] numdays fname source_path[ except...]
tm[s][a] numdays fname source_path dest_path[ except...]
The t signifies a tree move or delete. The t should be the first character on the line. Most of the task line is the same as the normal move or delete with the addition of the optional exception directories. Any directory listed as an exception (they may be more than one listed), will be excluded from the move or delete operation when it is encountered. Exception directories (like all paths in this program) must be specified in absolute form.
The command line option q will suppress all console message output (quiet), the l (el) option will output all messages to either the default log destination/file or the supplied destination/file, the n option will report only without taking any action and the c option will automatically create the destination base directory tree for the move operation.
Note that the switch character (a dash/hyphen [-] is shown here) depends on the platform the application is running on.