Have you considered finding all the directories and then counting the files of each from there:-
That will give you al the files from each directory and below, but of course the higher directories will have all the subdirectories included, so might not be what you want. If you need to , then perhaps you could sort this output and then for each directory, reduce the count by any direct subdirectories (i.e. take away /a/b from /a, but ignore /a/b/c)
Does this help at all, or have I missed the point?
Robin
Liverpool/Blackburn
Last edited by rbatte1; 06-19-2012 at 10:19 AM..
Reason: Added sort
Have you considered finding all the directories and then counting the files of each from there:-
That will give you al the files from each directory and below, but of course the higher directories will have all the subdirectories included, so might not be what you want. If you need to , then perhaps you could sort this output and then for each directory, reduce the count by any direct subdirectories (i.e. take away /a/b from /a, but ignore /a/b/c)
Does this help at all, or have I missed the point?
Robin
Liverpool/Blackburn
If you are happy with the above, you can adjust it to add the du command like so:-
Is that any good? This gives you the Kb for each directory on it's own. If you want to count all Kb from each directory and all sub-directories, drop the s flag from the du command.
Robin
Liverpool/Blackburn
UK
Last edited by rbatte1; 06-19-2012 at 10:48 AM..
Reason: Clarification of du
how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex.
so
mydemo--2015-03-23-1500.tar.gz
> database
-... (5 Replies)
Hi!
I just want to count number of files in a directory, and write to new text file, with number of files and their name
output should look like this,,
assume that below one is a new file created by script
Number of files in directory = 25
1. a.txt
2. abc.txt
3. asd.dat... (20 Replies)
Hi All!
I would like to have a script that will count the number of files at the top of the hour of soome directories and mail the results to me.
I was thinking on :
a=`/directory/subdirectory/ | wc -l`
echo "/directory/subdirectory :$a"
b=`/another_dir/subdir/ | wc -l`
echo... (12 Replies)
Can anyone come up with a unix command that lists
all the files, directories and sub-directories in the current directory
except a folder called log.?
Thank you in advance. (7 Replies)
Hi , this is homework .. I have to finish it tomorrow,
I did my best , but I found it so difficult .. Can You HELP Me ??!
Write a bash shell script filestatic. The script should examine the number files in directories given as arguments (parameters) to this script.
a. if one argument is... (1 Reply)
Hi,
Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process.
I wanted to disply using a unix command all the directories recursively excluding files.
I tried 'ls -FR' but that display files as... (3 Replies)
Hello,
I need help finding a script that will allow me to move files from one directory to another directory 10k files at a time.
I have a directory that has 100 K files in it. I need to have those 100k files broken apart to separate directories each with 10k files in them.
Here is the... (8 Replies)
I want to compare "N" (around 2000+) number of huge files located in a directory A against "N" files located in a different directory using Bash scripting.
Please help me with any scripts available.
Thanks. (2 Replies)