Centos linux how to search for File Created on a Specific Date
At Antheus we handle call recordings for a large number of clients and the number of files stacks into the millions! We recently had to find a very specific list of files amongst this very large pile and needed a way to find specific files created on specific dates. Heres how:
We use the ls command to retrieve a list of files in the directory and pipe it to grep which then returns only the lines which match our date search.
If we were looking for a file created on the 16th of June 2011 at roughly 5pm we would type:
ls -l | grep 'Jun 16 17'
Using CentOS we can also look for a file created on the 9th of June 2011 at a specific time as well but there is a small change:
ls -l | grep 'Jun(two spaces)9 17:01'
The reason for the two spaces is the way CentOS outputs the results of the ls command.
Note: This may work for other flavours of Linux but we’ve only tested it on CentOS… In reality this would work for any distro of Linux but you would have to change the grep search parameter to suit the output of the ls command for the distro you are using.