![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 | 07-09-2008 01:40 AM |
| Script for deleting 30 days older | moon_friend | Shell Programming and Scripting | 3 | 06-24-2008 09:43 AM |
| Deleting / finding files older than X days missess a day | guruparan18 | Shell Programming and Scripting | 4 | 05-08-2008 03:09 AM |
| tar files older than 30 days | wfch | UNIX for Dummies Questions & Answers | 6 | 04-19-2004 01:40 AM |
| delete files older than 7 days | lesstjm | UNIX for Dummies Questions & Answers | 1 | 11-06-2001 07:43 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Deleting specfic files older than N days
Hello,
I am trying to delete specific files older than 7 days that start with FSTRnnnn (nnnn=sequnce number) from /home/users/userdir I.E cd home/users/userdir ll FSTR0001 Jul 8 14:20 FSTR0002 Jul 6 12:01 FSTR0003 May 25 09:45 FSTR0004 April 2 17:20 MSTR0034 Jul 6 12:45 LSTR0095 May 7 22:06 Can someone tell me how do I safely delete FSTR files. Thank you |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
find . -type f -name "FSTR????" -mtime +7 -exec rm -f {} \;
|
|
#3
|
|||
|
|||
|
Great, this worked. What about if there are 5 or more characters in the FSTR files.
FSTR01234Jul 8 14:20 FSTR0001 Jul 8 14:20 FSTR0002 Jul 6 12:01 FSTR0003 May 25 09:45 FSTR0004 April 2 17:20 MSTR0034 Jul 6 12:45 LSTR0095 May 7 22:06 Thank you for your help! |
|
#4
|
|||
|
|||
|
Use FSTR*
|
|||
| Google The UNIX and Linux Forums |