Wednesday, July 4, 2012

More than one 'exec' action in 'find' command

More than one 'exec' action in 'find' command: When you run find command, you can pass the names of the found files to an arbitrary command using -exec option: find /tmp -mtime +3 -exe...

find /tmp -mtime +3 -exec rm {} \;
find /tmp -mtime +3 -exec sh -c 'ls -ld "$0"; rm "$0"' {} \;