Re: In regards of search (167 Views)
Reply
Regular Advisor
Indrajit Bhagat
Posts: 319
Registered: ‎07-22-2006
Message 1 of 3 (167 Views)

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.
Outstanding Contributor
Pete Randall
Posts: 16,205
Registered: ‎11-03-1996
Message 2 of 3 (167 Views)

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
Acclaimed Contributor
A. Clay Stephenson
Posts: 17,825
Registered: ‎07-16-1998
Message 3 of 3 (167 Views)

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.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.