1753593 Members
6239 Online
108796 Solutions
New Discussion юеВ

Re: In regards of search

 
Indrajit Bhagat
Regular Advisor

In regards of search

Hi, Sir,
How can we find the list of file created or having any changes during a particular date.
is there is any particular command please help me.
2 REPLIES 2
Pete Randall
Outstanding Contributor

Re: In regards of search

First, Unix has no notion of creation date - only last modification time is tracked.

To find files created on a certain date, use the touch command to create two files, one with a timestamp of 00:01 on your target date and one with a time stamp of 23:59 on your target date. The use the find command with a combination of -newer and ! -newer (not newer) to zero in on the files you seek.


Pete

Pete
A. Clay Stephenson
Acclaimed Contributor

Re: In regards of search

First, UNIX has no notion of the creation time of a file. ctime is change time (time of last chmod, chown and mtime is time of the last data modification.

Do something like this leveraging find's -newer option to find files modified on 15-Nov-2005 starting from the current working directory.

# create 2 reference files with timestamps just before and just after the date in question

touch -m -t 200511142359.59 /var/tmp/f1
touch -m -t 200511160000.00 /var/tmp/f2

# run the find command starta CWD looking for regular files that fit the date

find . -type f \( -newer /var/tmp/f1 -a ! -newer /var/tmp/f2 \) -print


If it ain't broke, I can fix that.