Thursday, February 5, 2015

Finding files which are created or modified after a certain time (Unix)

On unix, we frequently need to find any new files created/modified in a directory after a given time. You can do this with the touch and find command 

Create a file with the date you need
touch -t yyyymmddHHMM t.tmp (dummy file to have a timestamp)

List all files which are newer than the date of the tmp file
find <dir> -type f  -newer t.tmp -print -exec ls -lt {} \; 

No comments:

Post a Comment