In regards of search (185 Views)
Regular Advisor
Posts: 322
Registered: ‎07-22-2006
Message 1 of 3 (185 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
Posts: 16,207
Registered: ‎11-03-1996
Message 2 of 3 (185 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.


Acclaimed Contributor
Posts: 17,825
Registered: ‎07-16-1998
Message 3 of 3 (185 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.