How to find old file and ...

add the amount of bytes of the old files which reside in one directory to a sum for the whole directory?
Or: how to combine a "find . -type f -size +20000 -mtime +150..." with the "du -sxg" for the directory. ;-)
Or: What is the sum of sizes of old files in a directory/path ?
Is there anybody with a good idea or a script?
Thanks in advance!
Best regards,
Gerold

Popular White Paper On This Topic

There are bash and 'Running Linux' texts with beaucoup example scripts for things like this. See the bookstores for those O'Reilly volumes with animals on the front. I occasionally see them discounted at Book-a-Million and even on charity-store shelves. An outfit named APress (http://en.wikipedia.org/wiki/Apress) also publishes good stuff.

On Thu, Nov 19, 2009 at 10:07 AM, gerold.mueller via shellscript-l <
email@removed wrote:
> Posted by gerold.mueller
> on Nov 19 at 10:11 AM
> add the amount of bytes of the old files which reside in one directory to
> a sum for the whole directory?
> Or: how to combine a "find . -type f -size +20000 -mtime +150..." with the
> "du -sxg" for the directory. ;-)
> Or: What is the sum of sizes of old files in a directory/path ?
> Is there anybody with a good idea or a script?
> Thanks in advance!
> Best regards,
> Gerold

Hi Enrique,
....sure, this will give the size of the whole directory.
But I shall get only the amount of bytes of older files, e.g. older than 150 days.
For this I think I should take "find -mtime +150 ....".
If somebody could combine both, it would be nice.
I tried to connect "find" and "du" with "|", but "du" always brougt the size of the
whole directory, without to make any difference between old and new files.
Furthermore I shall go through a complete tree of directories.
Any further suggestions??
best regards,
Gerold