rmbin: Find/delete binary files in subdirectories

Package: softools

Usage

rmbin [-dinrv] [-o extns] [-e extns] dir1 dir2 ... dirN

Parameters

-d
Disable recursive descent into subdirectories.
-e extns
Exclude files with the listed extensions (whitespace delimited).
-i
Verify before deleting files without extensions. Files with well known extensions like ".[aoe]" are deleted without a query. A heuristic (ZFACSS) is used to determine the filetype of files with unknown extensions, and it can fail, though in practice it works quite well.
-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. For example, on a UNIX host, the following command will compute the disk space used by the binary files in a directory tree: % du `rmbin -n .` The -n option, of course, is also useful for verifying the delete operation before destroying the files.
-o extns
Delete only files with the listed extensions (whitespace delimited).
-r
Reenable recursive descent. Recursive descent is the default, however it may be turned off at one point in the command line, and later reenabled with this switch.
-v
Print names of files as they are deleted.

Note that flags may be inserted between directory name arguments to change switches for different directories.

Description

The rmbin task is used to descend a directory tree, deleting (or listing) all the binary files therein. The task may also be used to delete or list nonbinary files by explicitly listing their extensions.

Rmbin is used the strip the IRAF system down to the sources, prior to a full system rebuild. After changing to the IRAF root directory, one runs rmbin to delete all the binaries in lib, sys, pkg, etc. (but not in hlib, else a bootstrap will be necessary too). Mkpkg is then run to recompile the system; this currently takes about 20 hours on our UNIX 11/750 development system, provided nothing else is running on the system.

Examples

1. Delete all binaries in the pkg and sys directories of IRAF. The example is for a UNIX host, but this works for all other IRAF hosts as well.

% cd $iraf
% rmbin -v pkg sys

See also

rtar, wtar, mkpkg