Provide a count of files

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Provide a count of files
# 1  
Old 12-28-2007
Provide a count of files


I'm a unix newbie and need your help.

I need to get a count of files on our server. Number of .html files, Number of .pdf's, and Number of .ppt.

I tried:

find . -type f | wc -l

but it only give me a total count.

# 2  
Old 12-28-2007
find . -name \*.pdf|wc -l
find . -name \*.html|wc -l

# 3  
Old 12-28-2007
Great! That worked.

Is there a way to exclude a directory?

Thanks for your quick response.
# 4  
Old 12-28-2007
Add your -type f back in the mix
# 5  
Old 12-30-2007
u can use something like this find \*.{pdf,ppt} | wc -l

but it will not work bourne shell Smilie
# 6  
Old 12-30-2007
find /home -type f | awk 'BEGIN{ FS="[/.]"}
   print "No. of counts for pdf files is " ext["pdf"]

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for field wise record count for different Files .csv files

Hi, Very good wishes to all! Please help to provide the shell script for generating the record counts in filed wise from the .csv file My question: Source file: Field1 Field2 Field3 abc 12f sLm 1234 hjd 12d Hyd 34 Chn My target file should generate the .csv file with the... (14 Replies)
Discussion started by: Kirands
14 Replies

2. Shell Programming and Scripting

Error files count while coping files from source to destination locaton as well count success full

hi All, Any one answer my requirement. I have source location src_dir="/home/oracle/arun/IRMS-CM" My Target location dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc/$pc/$ct" my source text files check with below example.text file content $fn "\t" $dc "\t" $pc "\t" ... (3 Replies)
Discussion started by: sravanreddy
3 Replies

3. UNIX for Dummies Questions & Answers

How to count different id from a files?

Hi Guys, Please help for counting different task_id:- file name is: file records: Now we need to output like: (1 Reply)
Discussion started by: aaditya321
1 Replies

4. Shell Programming and Scripting

Count number of files

Hi All! I need to have a script that counts the number of files arriving in a landing directory, them some app pick these files to be processed and load to a DB. But this process is so fast that I am not able to count all the files arriving on a landing directory. Please can you help? My... (6 Replies)
Discussion started by: fretagi
6 Replies

5. Shell Programming and Scripting

Count Files

I was wondering if anyone could help me with this problem: Write a script called countFiles that takes two arguments, the initial directory and the number of levels and returns the count of all files (including directories) in the directories and subdirectories up to the number of levels. ... (4 Replies)
Discussion started by: clammy
4 Replies

6. UNIX for Dummies Questions & Answers

Count number of files in directory excluding existing files

Hi, Please let me know how to find out number of files in a directory excluding existing files..The existing file format will be unknown..each time.. Thanks (3 Replies)
Discussion started by: ammu
3 Replies

7. Shell Programming and Scripting

Count todays created files and old files

Hello experts, I used following approach to get listing of all files of remote server. Now I have remote server file information on same server. I am getting listing in the output.txt I want to count today's created files and old files. I want to compare the numbers... (11 Replies)
Discussion started by: dipeshvshah
11 Replies

8. Shell Programming and Scripting

Count files in every subdirectory

Hi if anyone could help me :) I did a lot of search and 70% of answer is "how to count files in all subdirectories". A basic problem for me is how to count files in every subdirectory separately then sort it by number of files For example: dir1 file1 file2 subdir11 dir2 dir3 ... (3 Replies)
Discussion started by: yorryk
3 Replies

9. Shell Programming and Scripting

count of files

How to count the number of files in a directory. Thanks Mahalakshmi.A (13 Replies)
Discussion started by: mahalakshmi
13 Replies
Login or Register to Ask a Question