Sponsored Content
Full Discussion: ls Help
Top Forums UNIX for Dummies Questions & Answers ls Help Post 56090 by google on Monday 27th of September 2004 09:36:01 PM
Old 09-27-2004
Use the find command

Here are several examples:
Code:
find / -name file1 -print
find / -name '*junk*' -print
find / -name \*.o -print

find / -mtime -6 -print    < 6 days ago
find / -atime +30 -print   > 30 days ago
find / -mtime 7 -print      exactly 7 days ago

You are probably more interested in this flavor....
Code:
find  .  -type  f  -atime  +30  -print

finds files with an access time of greater than 30 days - excludes directories

find / -atime +5 \(-name "*.o" -o -name "*.tmp" \) -print

finds all files with an access time of greater than 5 days that have extension .o or .tmp


The find command is really powerful as you can search for files modifed down to an exact (well almost) time using a reference file

touch -t 03201600 /tmp/datefile
creates a file with timestamp of March 20, 4:00

find . -newer /tmp/datefile -print
find files newer than timestamp of datefile - granular to within one minute
 
All times are GMT -4. The time now is 06:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy