homepage Welcome to WebmasterWorld Guest from 54.167.174.90
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Count files
In root and subdirectories.
gosman

10+ Year Member



 
Msg#: 3028897 posted 4:10 pm on Jul 31, 2006 (gmt 0)

I have a directory called CMS and under that directory I have multiple subdirctories each containing files. I need to count the files in the CMS directory and all of it's subdirectories. I usually acomplish this by downloading CMS to my Windows PC and using windows tools to do a file count, however this directory is now getting very large and this is a time consuming process.

Can anybody help me out with a UNIX command that will do the same?

I don't want a count of the directories just the files.

Any help would be much appreciated.

 

lammert

WebmasterWorld Senior Member lammert us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 3028897 posted 5:50 pm on Jul 31, 2006 (gmt 0)

Something like "ls -R ¦ wc" will do. This performs a recursive directory listing. The output is piped to wc, a utility that counts the number of words and lines.

modean987

5+ Year Member



 
Msg#: 3028897 posted 7:32 pm on Jul 31, 2006 (gmt 0)

If all you want is a total file count

find . -type f wc -l

find [period] [dash]type f [pipe] wc [dash][el]

If you copy/paste this line into a linux command prompt, make sure the pipe symbol is a solid vertical line (not the broken vertical line webmasterworld changes it to when trying to post this message).

gosman

10+ Year Member



 
Msg#: 3028897 posted 7:37 pm on Jul 31, 2006 (gmt 0)

Thanks Lammert

But I'm a complete *nix novice, so I'm looking for the exact command.

gosman

10+ Year Member



 
Msg#: 3028897 posted 7:40 pm on Jul 31, 2006 (gmt 0)

Thank you modean987

That done the trick

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved