how many files in a folder – number of files&folders du
The output is like that of du, so you get the recursive output of every subfolder.
1 2 3 4 5 6 7 8 9 10 11 12 |
# change /home to match the folder your interested in, change it to . for current folder (or remove the 'cd /home;' command) # number of files & folders (cd /home; IFS=$'\n'; for i in `find -type d`; do echo "`find $i | wc -l` $i"; done;) # number of files (cd /home; IFS=$'\n'; for i in `find -type d`; do echo "`find -type f $i | wc -l` $i"; done;) # number of folders (cd /home; IFS=$'\n'; for i in `find -type d`; do echo "`find -type d $i | wc -l` $i"; done;) # number of links, sockets, etc.. change the "-type d" to whatever you want - look at "man find" |
Output is: # name Where # is the number of files, folders, or both (orRead More…