damohickey
asked on
How to find number of files in a directory tree
What is the easiest way to find the number of files in a directory tree with the answer showing the number of files in each sub directory?
Note the change to this question.
Cheers,
Damo
Note the change to this question.
Cheers,
Damo
If you want to find the number of files of all tree,
ls -R |wc -l
ls -R |wc -l
ASKER
Here is the answer:
find <root of directory tree> -type d > <in_file>
cat <in_file> | while read FILE
do
echo "$FILE `ls $FILE | wc -l`" >> <out_file>
done
Cheers,
Damo
find <root of directory tree> -type d > <in_file>
cat <in_file> | while read FILE
do
echo "$FILE `ls $FILE | wc -l`" >> <out_file>
done
Cheers,
Damo
ASKER
Here is the answer:
find <root of directory tree> -type d > <in_file>
cat <in_file> | while read FILE
do
echo "$FILE `ls $FILE | wc -l`" >> <out_file>
done
Cheers,
Damo
find <root of directory tree> -type d > <in_file>
cat <in_file> | while read FILE
do
echo "$FILE `ls $FILE | wc -l`" >> <out_file>
done
Cheers,
Damo
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:
- PAQ & refund points
Please leave any comments here within the next 7 days
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
tfewster
Cleanup Volunteer
I will leave a recommendation for this question in the Cleanup topic area as follows:
- PAQ & refund points
Please leave any comments here within the next 7 days
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
tfewster
Cleanup Volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
cd mydir
find . -type f -print | wc -l
will give the number of regular files in that dir.
or use:
find /full-path-to-mydir -type f -print | wc -l