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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find command to locate old files 1

Status
Not open for further replies.

DonDavisFCB

Programmer
Aug 22, 2001
73
US
Man pages are to IBMish for me.
I want to use the find command to locate all the files on a server that have not been accessed or modified in over a year. Can someone help me with the syntax of the find command? I need to find those files and then calculate how much file space they are using.
 
You could try this:

Code:
find . -mtime +365 -type f | xargs  -I {} ls -l {} | awk '{x+=$5};END {print "total size: " x}'

I take it using -atime isn't the best idea because running with that option instead of -mtime will alter the last access time. Someone may be able to verify this last statement.

Ethan
 
also - example from ff manual

3. To list files that have not been used recently, enter:

ff -a +30 /dev/hd0

This displays the path name and i-node of each file that was last accessed
more than 30 days ago ( -a +30).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top