LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-15-2004, 04:44 AM   #1
AsteX
LQ Newbie
 
Registered: Oct 2004
Posts: 2

Rep: Reputation: 0
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

Last edited by AsteX; 10-15-2004 at 04:48 AM.
 
Old 10-15-2004, 04:51 AM   #2
320mb
Senior Member
 
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

Rep: Reputation: 48
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...................
 
Old 10-15-2004, 05:04 AM   #3
AsteX
LQ Newbie
 
Registered: Oct 2004
Posts: 2

Original Poster
Rep: Reputation: 0
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
 
Old 10-21-2004, 09:08 AM   #4
bmeckle
Member
 
Registered: Jun 2004
Posts: 60

Rep: Reputation: 15
Try the find command.

I believe you could use the -mtime flag to get what you are looking for.
 
Old 11-11-2004, 06:26 PM   #5
geppo_01
LQ Newbie
 
Registered: Nov 2004
Posts: 1

Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need a script to delete all files from a folder and subfolders cccc Programming 1 03-04-2005 10:54 AM
HELP: can't delete files/folders :( kevingpo General 1 12-07-2004 07:51 PM
bash script to delete files c0d3 Programming 9 12-05-2004 10:45 PM
Why does this script just delete my new wav files all the time? kleptophobiac Linux - Software 5 01-15-2004 09:06 PM
Script on linux to delete certain files ForumKid Linux - General 2 06-22-2002 01:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration