Link to home
Start Free TrialLog in
Avatar of bt707
bt707Flag for United States of America

asked on

File search

I have a directory on a solaris box that has about 15 sub directorys in it, In the sub directorys the files go from a few hundred to 100K, this is mail folders so the numbers change regularly.

I need a command or script that will tell me the totoal number of files that is in each directory and the total number of files that is in all of them, also which files is the 10 or 15 oldest files.


Ex:

ls /mailqueue

01  02  03  04  05  06  07  08  09  ect, ect


Thanks
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

> totoal number of files that is in each directory
for dirs in `find <path to direcotry> -type d -depth` ; do echo $dirs; ls -Al $dirs | wc -l; done

> the total number of files that is in all of them
find <path to direcotry> -type -f | wc -l

Wesly
Avatar of bt707

ASKER

those two worked great but the main thing is I need to find witch file in the sub directories is the oldest file, would like to find the oldest 10 files but the one that is the oldest would do.

Thanks,
Avatar of bt707

ASKER

also when i run this command
find <path to direcotry> -type -f | wc -l

it tells me how many sub directories is in the main directory, i'd like to find the total number of files in all the sub directories together.

Thanks agian

> find <path to direcotry> -type -f | wc -l
                                              ^^
Oops, there is a typo. Should be
find <path to direcotry> -type f | wc -l

Wesly
ASKER CERTIFIED SOLUTION
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bt707

ASKER

Thanks, all of these worked as good as you get.

Thanks again