Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Findign a file 1

Status
Not open for further replies.

vdsouza

Programmer
Oct 17, 2002
16
0
0
GB
How do i find a file on the same day and that has been modified between a particular time period.

For example.
I wish to find a file today i.e. 19 th Jan between 0900 and 1700 hours.
 
You can try something like this :

# Create file with creation date today 09:00
touch -t `date +'%Y%m%d0900'` /tmp/from_date

# Create file with creation date today 17:00
touch -t `date +'%Y%m%d1700'` /tmp/to_date

# Find files created after 09:00 (from_date)
# and not after 17:00 (to_file)
find . -newer /tmp/from_date -a ! -newer /tmp/to_date -print

# Delete work files
rm /tmp/from_date /tmp/to_date

Jean Pierre.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top