Assumptions:
Given a directory; it has n subdirectories and does not have any files. The subdirectories jsut have files and no folders.
You want to count all the files in the n sub directories.
here's a shell script:
filecount=0;
for i in $(ls);
do
cd $i;
a=$(ls | wc -l) ;
filecount=$[filecount+a];
echo $filecount;
cd ..;
done
Given a directory; it has n subdirectories and does not have any files. The subdirectories jsut have files and no folders.
You want to count all the files in the n sub directories.
here's a shell script:
filecount=0;
for i in $(ls);
do
cd $i;
a=$(ls | wc -l) ;
filecount=$[filecount+a];
echo $filecount;
cd ..;
done
No comments:
Post a Comment