rmfiles: Find/delete files in subdirectories

Package: softools

Usage

rmfiles [-dnv] [-f progfile] rootdir action extns

Parameters

-d
Print debug messages.
-n
No execute; do not delete files. This option may be used to generate a list of binary files for some purpose other than deletion, or to verify the delete operation before destroying the files.
-v
Print names of files as they are deleted.
-f progfile
Take delete commands from the named file. If this option is specified the remaining arguments are normally omitted.
rootdir
The root directory of the directory tree to be pruned. This must be a path from the current directory or from a logical directory.
action
The possible actions are listed below. This is a required parameter.
-all
Delete all files.
-allbut
Delete all files except those with the listed extensions.
-only
Delete only those files with the listed extensions.
extns
A list of filename extensions delimited by spaces, e.g., ".a .o .e .hlp".

Description

The rmfiles utility is used to delete (or list) files in one or more directory trees. If only one directory tree is to be pruned the necessary instructions can be entered on the command line, otherwise a program file must be used. When developing a program file, a dry run using the "-n" switch is recommended to see what files will be deleted.

If a program file is used each line in the file has one of two possible formats. If a directory is to be pruned the syntax is the same as is used when a one line program is entered on the command line, i.e.:

rootdir action extns

The significance of each field is as described in the ARGUMENTS section above. The program file may also contain lines of the form

-file filename

to delete one or more files by name. This is useful for removing files which do not fit into any recognizable class.

Comments and blank lines are permitted anywhere in the program file. All filenames are IRAF virtual filenames (or host filenames).

Rmfiles is a bootstrap utility implemented as a foreign task, hence it may be called either from within IRAF or from the host system.

Examples

1. Delete all .o, .e, .a, and .hd files in the directory "iraf$pkg". Print the names of the files as they are deleted. Note that one must move to the directory containing the directory to be pruned before running rmfiles.

cl> cd iraf
cl> rmfiles -v pkg .o .e .a .hd

2. Strip the entire IRAF system, using the program in file "hlib$stripper". The use of the $ in the filename here could cause problems on some systems since rmfiles is a foreign task.

cl> cd iraf
cl> rmfiles -vf hlib$stripper

See also

rmbin, rtar, wtar