Linked Questions
10 questions linked to/from What's the best way to count the number of files in a directory?
3
votes
3
answers
11k
views
Command to print the number of *.pdf files in a chosen directory [duplicate]
I am currently not on a Linux machine. Would the following command produce my wanted result?
ls | grep ".pdf" | wc
-1
votes
1
answer
77
views
Advice with How to Return the # of Files found within a folder [duplicate]
Create a script to ask a user for the name of a folder and have the script return the number of files found within the folder. If folder doesn't exist, display error message to the screen
I've gotten ...
361
votes
21
answers
955k
views
How can I get a count of files in a directory using the command line?
I have a directory with a large number of files. I don't see a ls switch to provide the count. Is there some command line magic to get a count of files?
225
votes
12
answers
244k
views
How do you move all files (including hidden) from one directory to another?
How do I move all files in a directory (including the hidden ones) to another directory?
For example, if I have a folder "Foo" with the files ".hidden" and "notHidden" inside, how do I move both ...
88
votes
5
answers
168k
views
Argument list too long for ls
I get the following error when trying to ls *.txt | wc -l a directory that contains many files:
-bash: /bin/ls: Argument list too long
Does the threshold of this "Argument list" dependent on distro ...
36
votes
2
answers
20k
views
Understanding find(1)'s -exec option (curly braces & plus sign)
Using the following command, could someone please explain what exactly is the purpose for the ending curly braces ({}) and plus sign (+)?
And how would the command operate differently if they were ...
3
votes
4
answers
2k
views
Determining number of files in a directory without counting them
Related: What's the best way to count the number of files in a directory?
I have a system with a largish number of files in a directory
$ ls -god xml
drwxrwsrwx 7 7070720 Mar 12 11:51 xml
If ...
4
votes
2
answers
710
views
save the number of files only in a specific folder
I'm using this script to save the number of files in a main folder, but it also counts the subfolders inside that main folder.
nfiles=$(ls -1 /home/userA/mainfolder | wc -l) Any advice how I can ...
-2
votes
2
answers
120
views
What is the job of the following shell script?
#!/bin/bash
echo " Enter the name of your directory. You should enter the absolute path to the directory if it is not found in the current directory!"
read location
echo $location
filecount=$( find $...
0
votes
2
answers
126
views
Bash - get file count
I have the following alias defined in my .bashrc
alias lsfc='ls -l "$@" | tee /dev/tty | grep -v / | echo "File count: `wc -l`"'
which is intended to give me the number of ...