![]() |
|
|
|
|
|||||||
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Deleting files older than 7 days | shezam | Shell Programming and Scripting | 4 | 2 Weeks Ago 01:40 AM |
| delete files and folders older than 3 days | melanie_pfefer | Shell Programming and Scripting | 7 | 12-18-2006 08:58 AM |
| tar files older than 30 days | wfch | UNIX for Dummies Questions & Answers | 6 | 04-19-2004 01:40 AM |
| How can I delete files older than 7 days? | odogbolu98 | UNIX for Dummies Questions & Answers | 3 | 02-26-2002 04:35 PM |
| delete files older than 7 days | lesstjm | UNIX for Dummies Questions & Answers | 1 | 11-06-2001 06:43 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Removing files older than 7 days
Script help, I need to delete files that are older than 7 days. I do that automatically but I know that a cron job can do the job for me. Any help is greatly appreciated, as you can see, I am a DOS or WINDOWS guy. Little on UNIX. Thanks
|
| Forum Sponsor | ||
|
|
|
|||
|
find ./ -type f -mtime +7 -exec rm -f {} \;
Warning, as coded, this will remove ALL files in the current directory and all subdirectories that were not either created or modified in the last 7 days. Other coding will be necessary to restrict to only current directory. |
|
|||
|
great, assuming I know that the files are all sport.xxxx where .xxxx is the current date e.g. 0420 for April 20, and also assuming we know the directory, I could write the code as: find \usr3\export\sport.* -type f -mtime +7 -exec rm -f; does this code will find files that are older than 7 days with the name bag.*** and delete them? thanks for the help
|
|||
| Google UNIX.COM |
| Thread Tools | |
| Display Modes | |
|
|