Results 1 to 5 of 5
Hi, on linux how can i delete files older than the current month (that is leave only this month's files) from one subdir and recurse every directory?
thanks....
- 10-16-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 2
linux command help
Hi, on linux how can i delete files older than the current month (that is leave only this month's files) from one subdir and recurse every directory?
thanks.
- 10-16-2007 #2
This sounds like a homework question, so I'll answer a little cryptically. Take a look down the 'man' page for 'rm', (i.e. do 'man rm' at the command prompt) and look at how you limit what it removes.
It might also help if you look into the 'find' command, which can search directory trees based on file name, access date, creation date, etc. Read up with 'man find' to look into this.Linux user #126863 - see http://linuxcounter.net/
- 10-16-2007 #3
Hi chakytori,
Check this out this how to use find with exec
find - Wikipedia, the free encyclopedia
@ Roxoff -- yes it works like home work question
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 10-18-2007 #4Just Joined!
- Join Date
- Oct 2007
- Posts
- 37
- 10-18-2007 #5Just Joined!
- Join Date
- Oct 2007
- Posts
- 2
Hi!
This is meant to keep older files in our forum script deleted using a cron job, our forum is simple and we just want to keep the current month files.
I think there may be an easier way since our script names the files 0704.txt (07 the year and 04 the month) so manually i just need to delete this files:
0706.txt 0707.txt 0708.txt 0709.txt
from every directory from the /home/username directory upwards because we have diferent directories for every forum on the site and each one keeps the log files on their dir, how can this be done?
thanks a lot for the help.


Reply With Quote
