Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Delete all files in sub-dir +10 old
Name: ihosail Date: October 3, 2005 at 06:59:29 Pacific OS: Unix CPU/Ram: Unix
Comment:
Please help...
I need to delete files in all sub-directories that are more than 10 days old or delete all sub-directoires (entire directory) that's 10 days old (this is risky). I have an archive directory /archive and many subdirectories as /archive/Sep01, /archive/Sep02 etc. with month and day naming convention.
This command will delete all files that were modified 10 days ago: find /archive -type f -mtime +10 -exec rm {} \;
How do I use similar command to delete all files within the sub-directories of /archive as well?
Name: anupam Date: October 3, 2005 at 20:44:52 Pacific
Reply:
find command is recursive....it will delete all files in your sub directories of /archive as well according to the condition that you have given to it.
Anupam
0
Response Number 2
Name: GordonBe Date: November 30, 2005 at 12:17:13 Pacific
Reply:
Also for dirs you need to set -rf flag for rm to force deletion.
Summary: I have a ftp site, where I am using the following CRON scheduled script to delete all files in sub-directories that are older than 14 days. It works fine till now. find . -mindepth 2 -mtime +14 -exec ...
Summary: hie there, i would like to know how do i compare files in a current directory? i don't want to compare just 2 files with the diff filename1 filename2. i need to compare all the files in the cur...
Summary: i have a directory "ABC" with lots of old files and sub directories in it. the issue now is i want to delete away files which are older than 15 days in "ABC" without deleting the files in the sub dire...