Show the number of file on folder.
Hi all,
My folder have some files and I want to show the number of files on folder at "Total file on folder: " Ex: Monday folder have six files and it will show "Total file on folder : 6" when I run a script. This is my code : #!/bin/sh if [ -d /home/kenzo/Monday/ ] && { echo "Monday" ls -l /home/kenzo/Monday/ };then echo "================================================= ===" echo "Total file on folder: " else echo -e "Folder of Monday not find." echo "================================================= ===" fi exit 0 Is it possible, pls intruct me how to do it. Thanks ! |
Quote:
echo "The number of files in this folder is `ls -1|wc -l`" Which displays: The number of files in this folder is 87 |
Quote:
the following will print the number of files (!) in the folder; directories will not be counted. Code:
find /path/to/folder -maxdepth 1 -type f -print |wc -l |
All times are GMT -5. The time now is 01:09 AM. |