Unix & Perl – Code Snippets

Delete files older than 1 day:

$cmd = "find /tmp/*.jpg -type f -mtime +1 | xargs rm -f";   
$res = `${cmd}`;

Find files containing a specific phrase, in a directory tree:

find . -exec grep -i -l phrasetofind {} \;