Deleting specific files greater then 90 days


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Deleting specific files greater then 90 days
# 1  
Old 07-22-2004
Deleting specific files greater then 90 days

I have a directory that contains a number of history files for a process. Every file starts with the string "EVACK". FOr example

EVACK0101.000001
EVACK0102.095940
EVACKmmdd.hhmiss

I want to erase in the specific directory ONLY(no sub-directories) all EVACK files older then 90 days. I tested the find command using the following script.

find . -name "EVACK*" -ctime +90 -exec ls {} \;

and it found files in subdirectories that started with EVACK, which are older then 90 days and which I don't want deleted. Can anyone help me out with the correct command?

I looked in the Dummy answers and they all suggested find.
# 2  
Old 07-22-2004
Check your version of the find command - see if it has a -prune option. That should work.

If you don't have that, then post your OS and version for more assistance or see this thread.

Last edited by RTM; 07-22-2004 at 04:03 PM..
# 3  
Old 07-22-2004
I think I got it.

find . \( ! -name . -prune \) -name "EVACK*" -type f -mtime +90 -exec ls {} \;

Last edited by beilstwh; 07-22-2004 at 04:36 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

List of Files which are Greater then a specific date

A newbie question... I need to get a list of the Files and folders which are greater then a specific date. I want write the output to a Text file. What I know ls -lrt gives me list of all the files ordered by date. Also ls > fileName will write the results to a text file. Please help (6 Replies)
Discussion started by: rkaif
6 Replies

2. UNIX for Dummies Questions & Answers

How do I find files which are older than 30 days and greater than 1GB

Hi All, I know the separate commands for finding files greater than 30 days and finding files greater than 1GB. How do I combine these two commands? Meaning how do I find files which are > 1GB and older than 30 days? ;) (4 Replies)
Discussion started by: Hangman2
4 Replies

3. AIX

Deleting files older than 14 days automatically

Hi In my aix server under the location "/usr/sap/SAPXI/extract", I have a lot of log files. I need a script which is to be added in crontab so that the files and directories older than 14 days should get deleted automatically from the location "/usr/sap/SAPXI/extract". Please advise me.... (3 Replies)
Discussion started by: samsungsamsung
3 Replies

4. Shell Programming and Scripting

deleting files older than 7 days

Hi Guys, I am new to unix I am looking for a script to delete files older than 7 days but i also want to exclude certain directories (like arch,log .....) and also some files with extensions ( like .ksh, .ch, ..............) Thanks (1 Reply)
Discussion started by: MAYAMAYA0451
1 Replies

5. Shell Programming and Scripting

Deleting specific rows in large files having rows greater than 100000

Hi Guys, I need help in modifying a large text file containing more than 1-2 lakh rows of data using unix commands. I am quite new to the unix language the text file contains data in a pipe delimited format sdfsdfs sdfsdfsd START_ROW sdfsd|sdfsdfsd|sdfsdfasdf|sdfsadf|sdfasdf... (9 Replies)
Discussion started by: manish2009
9 Replies

6. UNIX for Dummies Questions & Answers

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... (3 Replies)
Discussion started by: eurouno
3 Replies

7. Shell Programming and Scripting

Deleting files older than 7 days

Hi Guys, I want to delete folder/files older than 7 days. Im using the command below. find /test/test1 -mtime +7 -print0 | xargs -0 rm -Rf /test/test1/* which works ok, but it deletes the test1 folder as well which i dont want. The test1 folder will have a list of sub-folders which in... (4 Replies)
Discussion started by: shezam
4 Replies

8. UNIX for Dummies Questions & Answers

Deleting certain files over 30 days old

Hi, I must confess i have a very basic knowledge of UNIX and its commands, but i was hoping someone would be able to help answer my query. Once a month as part of a team we have to perform housekeeping on our UNIX directories, we remove certain files older than 30 days and compress the... (3 Replies)
Discussion started by: swellybro
3 Replies

9. Shell Programming and Scripting

Deleting files over 7 days old

Simple question I am sure - but one that I dont know the answer to nevertheless.. I have a directory that I store log files in - but I wish to run a daily script in cron to delete all files in this directory that have not been modified within the last 7 days... Can anyone help me? (10 Replies)
Discussion started by: frustrated1
10 Replies

10. UNIX for Dummies Questions & Answers

Deleting files created before two days ago

Dear All: I want to build a shell that delete files created two or more days ago ... I think it could be built using a special command with ls or grep, I'd apreciate any help from you guys I have a lot of log files from november, december, january and this tool will help me a lot The files... (3 Replies)
Discussion started by: josecollantes
3 Replies
Login or Register to Ask a Question