[prev] [index] [next]

find: search for files (cont)

More Examples:

# find all new HTML files below /home/jas/web
find  /home/jas/web  -name '*.html'  -mtime -1  -print

# find background colours in my HTML files
find  ~/web  -name '*.html'  -exec grep -H 'bgcolor' {} \;

# above could also be accomplished via ...
grep  -r  'bgcolor'  ~/web

# make sure that all HTML files are accessible
find  ~/web  -name '*.html'  -exec chmod 644 {} \;

# remove any really old files ... Danger!
find  /hot/new/stuff  -type f  -mtime +364  -exec rm {} \;
find  /hot/new/stuff  -type f  -mtime +364  -ok rm {} \;