Script Questions
Nathan Kinkade
nkinkade at ub.edu.bz
Fri Feb 11 08:35:56 PST 2005
On Thu, Feb 10, 2005 at 04:24:34PM -0800, Chris Sechiatano wrote:
> > Use -print0 (that's a zero at the end of print), and the -0 option of
> > xargs. Then the whitespace shouldn't matter.
> >
> > # cd /storage/users
> > # find . -type d -print0 | xargs -0 du -sk
> >
> > That should do it.
> >
> > - Giorgos
>
> This is close to what I was trying before. Is there a way I can pipe the
> output of locate into xargs? The filesystem is 680 Gigs and I'd like to
> only search it once if possible.
>
> This doesn't work:
>
> # slocate -i -d /tmp/04vfile001_db *.wmv | xargs -0 ls -l
How about using differnt tools altogether? If you are not concerned
with lots of little files, but mostly worried about lots of large files
then how about using a mixture of find(1) and du(1)? You can pass a
-size argument to find that will only give you files greater than a
certain size, for example:
# find /home/users -size +10240k > big_files
This should find every file that exceeds approx. 10MB in size and dump
the output to file for later parsing. Or if you are concerned with the
overall size of a particular group of directories (perhaps those of
users) something like this should work:
# find /home/users -type d -maxdepth 1 | xargs du -sh
Nathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20050211/05be5655/attachment.bin
More information about the freebsd-questions
mailing list