TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login CONVERT LENGTH
login CONVERT TEMPERATURE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login WORK CALCULATOR
login CALCULATE LIFE

Linux commands, scripts, examples, tutorial

Previous articlePage bottomNext article  ALL TOPICS

Linux. How many files are in folder? Count files in multiple directories

 If all you want is a total file count (multiple directories):
find . -type f ¦ wc -l
or with max depth:
find targetdir -type f -maxdepth 1 | wc -l
To determine how many files there are in the current directory, put in:
ls -1 | wc -l
If you want to count only files and not include symbolic links (just an example of what else you could do):
ls -l | grep -v ^l | wc -l
Recursive:
ls -laR | wc -l
Another recursive:
ls -R | grep mp3 | wc -l 
Previous articlePage topNext article  ALL TOPICS


Guest:
To find count of files including symlinks. find -type f command does not return symbolic links. To include symbolic links, add the -follow option to find:

find targetdir -type f -follow -maxdepth 1 | wc -l


2013-06-07 11:13:21
Guest:
Hi

copy all files in subdirectories to one folder
 
find ./*  -type f -exec cp -i  {} ./  \;


2013-10-02 05:54:33

 Use username: Guest, Anonymous, Programmer






QUOTES:
Obscenity is a moral concept in the verbal arsenal of the establishment, which abuses the term by applying it, not to expressions of its own morality but to those of another.
Herbert Marcuse
Enjoy when you can, and endure when you must.
Johann Wolfgang von Goethe
Kings fight for empires, madmen for applause.
John Dryden