Script Questions

Giorgos Keramidas keramida at ceid.upatras.gr
Thu Feb 10 15:33:27 PST 2005


On 2005-02-10 15:17, Chris Sechiatano <chris at chris-s.com> wrote:
>
> I have a filesystem which is being used by MS workstations.  People
> are storing mp3's, jpgs and other 'non work related files' on here and
> the management asked me to find all the files and how much space they
> are using.
>
> I created a locate database of the filesystem so I can search that,
> but the problem is it doesn't show the file sizes.  I tried to pipe
> the output to xargs, but that didn't work either.  The file names and
> paths are pretty long and there's lots of file with single quotes and
> spaces that xargs does not like I guess.
>
> ex:
>
> /home/users/CRANESP1/Backup from 7-19-04/My Document's Backup 10-01-02/e-mails to save/eyetest_1.wmv
>
> Does anybody have anything that would work in this case?  I need to do
> this for about 40k files.

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



More information about the freebsd-questions mailing list