[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Help with shell script



> I'd appreciate if you can guide me/help me on a script on deleting files/directories more than two days old on Redhat servers.

find WHATEVER -mtime +2 -type f -exec rm \{} \;

substitute WHATEVER with the top-level directory you want to purge on.
Follow this with.

find WHATEVER -mtime +2 -type d -exec rm -f \{} \;

Which will delete empty directories which haven't been modified for two
days.

DISCLAIMER: Test these before use.  I provide no guarantees that anything
here will work as promised.  This is provided merely as an aid to help you
develop your own system.  No implication of usefulness is made by my post.

Jon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]