1

I'm try to use something similar to this StackOverflow article: Why does "find . -name *.txt | xargs du -hc" give multiple totals?

But just can't see to crack it, even after browsing several articles here and around the web.

All I'm trying to do is keep an eye on what storage has been used on our network drive per day/week/month/year/whatever, and where it's being used. All I want to do is use find to discover anything newer than x but older than n, and pipe the result (many directories and file paths) in to du using the -h switch to add the file/directory sizes on, which finally gets outputted to a file.

Here's what I've written so far:

export newerthan="1 Apr 2014 00:00:00" export olderthan="30 Apr 2014 23:00:00" find /Volumes/Competition -newermt "$newerthan" ! -newermt "$olderthan" | du -h > files.dat

This works correctly if I remove the du portion (it correctly prints a list matching the criteria into files.dat), however with the du portion there, it will simply print the entire current working directory's file/directory sizes.

Is anyone able to assist?

EDIT: It's worth mentioning I'm doing this on OS X.

Cheers, Brodie

Community
  • 1
  • 1

0 Answers0