Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux command to check new files in file system

Tags:

We have linux machine we would like to check what new files have been added between a certain date range.

I only have SSH access to this box and it's openSUSE 11.1

Is there some sort of command that can give me a list of files that have been added to the filesystem between say 04/05/2011 and 05/05/2011

Thanks

Regards Gabriel

like image 726
Gabriel Spiteri Avatar asked May 05 '11 06:05

Gabriel Spiteri


People also ask

How do I find recently added files in Linux?

You can use the ls command to list files including their modification date by adding the -lt flag as shown in the example below. The flag -l is used to format the output as a log. The flag -t is used to list last modified files, newer first.

How do I find new files?

File Explorer has a convenient way to search recently modified files built right into the “Search” tab on the Ribbon. Switch to the “Search” tab, click the “Date Modified” button, and then select a range. If you don't see the “Search” tab, click once in the search box and it should appear.


2 Answers

There are bunch of ways for doing that.

First one:

start_date=201105040000

end_date=201105042359

touch -t ${start_date} start

touch -t ${end_date} end

find /you/path -type f -name '*you*pattern*' -newer start ! -newer end -exec ls -s {} \;

Second one: find files modified between 20 and 21 days ago:

find -ctime +20 -ctime -21

finds files modified between 2500 and 2800 minutes ago:

find -cmin +2500 -cmin -2800

And read this topic too.

like image 96
ilalex Avatar answered Oct 07 '22 20:10

ilalex


Well, you could use find to get a list of all the files that were last-modified in a certain time window, but that isn't quite what you want. I don't think you can tell just from a file's metadata when it came into existence.

Edit: To list the files along with their modification dates, you can pipe the output of find through xargs to run ls -l on all the files, which will show the modification time.

find /somepath -type f ... -print0 | xargs -0 -- ls -l 
like image 20
Ryan C. Thompson Avatar answered Oct 07 '22 20:10

Ryan C. Thompson