Monday, July 11, 2011

Bash - loop through files updated in last 7 days

From command line or in a bash script, to loop thorugh all files that have been updated in the last however many days (in this example 7)...use the FIND command...


FILES=$(find /path/to/directory/ -type f -mtime -7)
for f in $FILES
do

echo $f

done

No comments: