find

counting files

Howto count files in a directory (wc will count the lines)

find . | wc -l

if you want only files, use:

find . -not -type d | wc -l

and if you don't want to dive into subdirectories:

find . -not -type d -maxdepth 1 | wc -l

find files at specific age

Delete all files not modified 180 days before:

find . -mtime +180 -exec /bin/rm {} \;

Print all files modified within the last 60 minutes:

find . -mmin -60 -print

Show disk usage

Print which directories in the current directory occupy how much space (in megabytes):

find . -maxdepth 1 -type d -exec du -ms {} \; | sort -nr
linux/find.txt · Last modified: 2007/11/22 12:22 by tb
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0