LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Delete old files and folders Script? (https://www.linuxquestions.org/questions/linux-general-1/delete-old-files-and-folders-script-242890/)

AsteX 10-15-2004 04:44 AM

Delete old files and folders Script?
 
Hi LQ,

I need a small script to delete files and folders if they are older than 3 months. I can't seem to find any script that can do this?
And it would be sweet if it would maked a small log of what was deleted!

Thanks..

/Jesper

320mb 10-15-2004 04:51 AM

Re: Delete old files and folders Script?
 
Quote:

Originally posted by AsteX
Hi LQ,

I need a small script to delete files and folders if they are older than 3 months. I can't seem to find any script that can do this?
And it would be sweet if it would maked a small log of what was deleted!


you really need to learn $BASH scripting and write your own...................

AsteX 10-15-2004 05:04 AM

Re: Re: Delete old files and folders Script?
 
Quote:

Originally posted by 320mb
you really need to learn $BASH scripting and write your own...................
I guess so :( No help from you!


/Jesper

bmeckle 10-21-2004 09:08 AM

Try the find command.

I believe you could use the -mtime flag to get what you are looking for.

geppo_01 11-11-2004 06:26 PM

Check out tmpwatch. I believe it is pretty standard on most distributions.

NAME
tmpwatch - removes files which haven?t been accessed for a period of
time

SYNOPSIS
tmpwatch [-u|-m|-c] [-faqstv] [--verbose] [--force] [--all] [--test]
[--fuser ] [--atime|--mtime|--ctime] [--quiet] <hours>
<dirs>

I run it every night using cron to keep my scratch partition clean.

Gerald


All times are GMT -5. The time now is 10:39 PM.