11-02-2011
thanks, but there are a lot of directories and when i try to run it in /home it doesnt work
the /home directory has about 1000 accounts
and when i start the program it doesnt load
each user has probably over a thousand directories
i tried running it on one directory and it listed a thousand of them
is there a way to only list it if its more than X number of files in that directory?
and a way to speed it up in the beginning?
otherwise it will list like a million files on the screen
thanks
---------- Post updated at 03:48 PM ---------- Previous update was at 03:44 PM ----------
ok i modified it a bit
what does the {'s do around the variable?
#!/usr/bin/ksh
find /home/bbweb -type d | while read mDir; do
mTot=$(find ${mDir} -type f | wc -l)
if test $mTot -gt 1000
then
echo "${mDir} ${mTot}"
fi
done
out put is something like
/home/bbweb 2470
/home/bbweb/public_html 2372
/home/bbweb/public_html/videos 1209
find: /home/bbweb/public_html/media/categories/Signatures: No such file or directory
im not sure why the last line says it cant find the directory?
thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I would like to list the files from all directories that has been modified more than 1 month ago, and whose name is like '*risk*log'.
I think a script like this should work :
ls -R | find -name '*risk*.log' -mtime 30 -type f
But it tells me "no file found" though I can see some.
... (4 Replies)
Discussion started by: Filippo
4 Replies
2. UNIX for Dummies Questions & Answers
I want to count how many levels there are under a directory. I repeat level.
Also how i count only all the files in a directoy ( all files of all directories of all leves down!)
and how can i count only all the directories under a directory (including subdirectories, all levels down)
... (2 Replies)
Discussion started by: psalas
2 Replies
3. Shell Programming and Scripting
Hi All I am writting a script that does a comparison between files in 2 diffectent directories.
To do this I need a command that will list out only the files in a give directory and omit any sub dorectories with that directory. But I am unable to find it.
Please Help.
I tried
ls... (5 Replies)
Discussion started by: Veenak15
5 Replies
4. Shell Programming and Scripting
Hi
I am looking for the correct syntax to find all files in the current directory without listing sub-directoris. I was using the following command, but it still returns subdirectoris and files inside them:
$ ls -laR | grep -v ^./
Any idea? Thanks
PS I am in ksh88 (4 Replies)
Discussion started by: aoussenko
4 Replies
5. UNIX for Dummies Questions & Answers
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)
Discussion started by: pointers
3 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I try to list all files in a folder, including all the subdirs (and their subdirs) and all files contained in each of these folders. I then print it to a simple txt file.
I use ls -R -1 >test.txt
This sort of does what I need, yet, the result is something like:
It reasonably comes... (53 Replies)
Discussion started by: dakke
53 Replies
7. UNIX for Dummies Questions & Answers
Hello, can you please help me writing a command that would output the biggest files on my system from biggest to smallest? I want this to print only the files, not the directories.
I have tried
du -a ~ | sort -nr | head -10
However, this also prints out all the directories - which I do... (8 Replies)
Discussion started by: tonydaniels1980
8 Replies
8. Shell Programming and Scripting
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)
Discussion started by: Manjunath B
7 Replies
9. UNIX for Dummies Questions & Answers
First I'm new to Linux and have used the find command pretty often but this is where I've hit a snag. I have a file that contains 3500 files that I want to find and then eventually copy to my own directory (these files are all on a shared directory at work atm).
Our work computer are huge and... (2 Replies)
Discussion started by: Myrona
2 Replies
10. Solaris
Hi everyone
My issue is this, I need to list all the sub directories in a directory that contains files that have the extension *.log, *.dat and *.out . After reviewing the output i need to delete those directories i do not need. I am running Solaris 10 in a bash shell. I have a script that I... (2 Replies)
Discussion started by: jsabo40
2 Replies
LEARN ABOUT FREEBSD
ckdist
CKDIST(1) BSD General Commands Manual CKDIST(1)
NAME
ckdist -- check software distributions
SYNOPSIS
ckdist [-airsx] [-d dir] [-n name] [-t type] file ...
DESCRIPTION
The ckdist utility reads ``checksum'' files (which are assumed to specify components of a software distribution) and verifies the integrity
of the distribution by validating the checksum of each component file. Both MD5 (128-bit ``message digest'') and .inf (32-bit CRC) checksum
formats are supported.
The file operands may refer to regular files or to directories. Regular files named md5, or which have an .md5 or an .inf extension, are
assumed to be of the implied type, otherwise format is determined from content. If a directory is specified, it is searched for appropri-
ately-named files only.
The options are as follows:
-a Report on all distribution components, not just those in respect of which errors are detected.
-i Ignore missing distribution components.
-r Search specified directories recursively.
-s Suppress complaints about inaccessible checksum files and directories.
-x Verify the existence of distribution components (and also check sizes, in the case of .inf files), but omit the more time-
consuming step of actually computing and comparing checksums.
-d dir Look for distribution components in the directory dir.
-n name Access distribution components using the filename name. When accessing .inf file components, append the appropriate exten-
sion to the filename.
-t type Assume that all specified checksum files are of the format type, and search directories only for files in this format (where
type is either md5 or inf).
EXIT STATUS
The ckdist utility exits with one of the following values:
0 No errors were detected.
1 Errors were found in a distribution.
2 Usage errors, inaccessible input files, or other system errors were encountered.
SEE ALSO
cksum(1), md5(1)
NOTES
Both BSD and DOS versions of ckdist are available.
BSD
January 20, 1997 BSD