网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 服务器与数据库 > Linux
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Reply
 
Thread Tools Display Modes
  #1   IP: 153.99.39.21
Old 2015-08-18, 03:40 PM
Kaleva Kaleva is offline
初级会员
 
Join Date: 2011-12-22
Posts: 1
Kaleva 现在声名狼藉
Default How to count all files inside a folder, its subfolder and all

How to count all files inside a folder, its subfolder and all . The count should not include folder count

I have a really deep directory tree on my Linux box. I would like to count all of the files in that path, including all of the subdirectories.

For instance, given this directory tree:
/home/blue
/home/red
/home/dir/green
/home/dir/yellow
/home/otherDir/
Reply With Quote
  #2   IP: 153.99.39.21
Old 2015-08-18, 03:41 PM
Sabin Sabin is offline
初级会员
 
Join Date: 2007-11-23
Posts: 1
Sabin 现在声名狼藉
Default

find . -type f | wc -l

Explanation:
find . -type f finds all files ( -type f ) in this ( . ) directory and in all sub directories, the filenames are then printed to standard out one per line.

This is then piped | into wc (word count) the -l option tells wc to only count lines of its input.

Together they count all your files.
Reply With Quote
  #3   IP: 153.99.39.21
Old 2015-08-18, 03:42 PM
Quakertown Quakertown is offline
初级会员
 
Join Date: 2011-03-13
Posts: 1
Quakertown 现在声名狼藉
Default

Find all files under home and count them using wc. This works on linux:

find home -type f | wc -l
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 10:44 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.