tw
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
|