Aug
23
If a directory has a large number of files on your Linux, UNIX or Solaris system and you are puzzled about their count then it is very easy
Just do
ls –l | wc –l
ls will list the files and wc –l will count the number of lines
If you want to count some specific type of file then you can use ls with the * operator to list only the desired type and then feed it to wc
suppose you want to count the number of .tmp files
You can do
ls -l *.tmp | wc -l
Related posts:
- How to download directory using ftp unfortunately using the bare-bone command line shell ftp which comes...
- cp to copy from Current to previous directory It took me a couple of minutes to figure out...
- How is Linux Different than Solaris Differences between Linux and Solaris Linux is also just a...
- How to delete protected vista files from XP by booting to windows XP I was trying to free...
- FTP Files from Shell Script Here is a sample bash or shell script that will...
- Search and replace text in all files in Sub directories if you want to Search for a particular string or...
What if I also want to count the files in Sub directories?