Clean up old files

If you have a program or script that you'd like to give away or sell, this is the place to do it. All offers should include contact info.

Moderators: BBear, theunknownhost, flaguy

Post Reply
User avatar
alsmith
Nothing better to do.
Posts: 183
Joined: Fri Feb 21, 2003 9:36 pm
Location: Kennesaw, GA
Contact:

Clean up old files

Post by alsmith » Sat Mar 15, 2003 3:11 pm

The forum has many suggestions to clean up old files but I do it a little differently.

Here is the forum link http://alahosts.com/phpBB2/viewtopic.php?t=43

You can place this in a cron or just run it from time to time:

Code: Select all

 #clean up old files
find . -type f -mtime 30 -exec rm {} \;


This will delete files more that 30 days old so you could substitue the 30 with any number. Also you will note that it runs from the current directory thus the . after the find.

You could use:

Code: Select all

 #clean up old files
find /home/tmp-backup/client -type f -mtime 10 -exec rm {} \;

to clean files from the /home/tmp-backup/client that are older than 10 days.

I hope this helps. By the way my code is in a shell that I can execute from the command line or from cron. You can name it whatever you like. I use cleanclients.sh.

-Al

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest