tw Authors


tw

tw(1) is a combination of find and xargs that applies C style expressions on the stat structure of each file in a directory hierarchy.
     tw
lists the directory hierarchy under the current directory,
     tw chmod go-rwx
changes the mode of all files in the directory hierarchy under the current directory by calling chmod as few times as the exec arg limit allows.
     tw -d /usr/src -e "name=='*.[chly]'" grep FOOBAR
greps for FOOBAR in all the C source files in /usr/src.

tw efficiently prunes the file tree search; it follows symbolic links by default (logical walk). The getconf variable PATH_RESOLVE controls the default behavior for all ast commands:

     getconf PATH_RESOLVE - physical
sets the default to not follow symbolic links, logical to follow, and metaphysical to follow only command line symbolic links (corresponding to the -P, -L and -H command options that override the default).
     tw -P -e type==LNK
does a physical walk that lists all symbolic links.
     tw -e "mtime>='yesterday morning'"
lists all files modified since yesterday morning. The magic file types from the file command are available in tw expressions (tw and file use the same library routine in libast):
     tw -e "(mode & 'u+s') && magic == '*script*'" chmod u-s
finds all setuid scripts and turns off the setuid mode bit. The magic file also contains MIME types:
     tw -e "mime == '*/exe'"
lists all executable programs (a.out's).


Authors

Glenn Fowler, David Korn, Phong Vo.


Glenn Fowler
Information and Software Systems Research
AT&T Labs Research
Florham Park NJ
September 16, 1999