Delete last 10 days logs


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Delete last 10 days logs
# 8  
Old 09-08-2008
I tried it - it works overhere. I have no clue, sorry.
Maybe you post a "ls -l" of those files and what you entered.
# 9  
Old 09-09-2008
Hi zaxxon

I have one ore dout..

find . -type f -name "*.log" -mtime 3 -print

its showing current directory *.log files this is k for me

but if i use
find . -type f -name "*.log" -mtime +3 -print -->its showing some other directory *.log files also

I want to delete current directory *.log files only pls advice me ..
# 10  
Old 09-09-2008
Strange. Nevertheless, "find" is recursive; check out the -prune switch in the man page and play around with it to prevent it to descent into subdirs.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting 3 days old logs from a directory

As i am working in unix environment so i have an logs that is created by my application at the following location that is /opt/app/glac/current/servers/ops/logs inside the logs directory there are different kinds of logs(that is the file having extension as .log ) have been created... (1 Reply)
Discussion started by: 2015nks
1 Replies

2. Shell Programming and Scripting

Delete files 30 days old

Will this work to delete files 30 days old in $backupDir or is there a better way to do it? find $backupDir -type f -mtime +30 -exec rm {} \; (2 Replies)
Discussion started by: wyclef
2 Replies

3. Shell Programming and Scripting

Delete logs older than 60 days

i am using HP-UX OS...... delete logs older than 60 days find -mtime +60 | grep -i '.*log' | xargs rm -mtime is nt available in HP-UX, pls tell me other option ? (2 Replies)
Discussion started by: only4satish
2 Replies

4. Shell Programming and Scripting

[Solved] Fetching logs of last few days from logfile

Hi All, I have a requirement to fetch logs of last 'N' days. I am trying the following command which is working fine if it finds the date of that day in logfile. START=`TZ="GMT+$((24*N))" date +"%Y %b %d"` this is being used to fetch 'N'th day's date and awk '/'"$START"'/{p=1}... (24 Replies)
Discussion started by: KDMishra
24 Replies

5. Shell Programming and Scripting

To delete logs older than 30 days

I want to write a shell script that deletes all log files in a directory that are older than 30 days except for 3 files: I am using the following command: find /tmp/logs -name "*.log" -mtime +30 -exec rm -f {} \;But this command deletes all the log files. How can i modify this script that... (5 Replies)
Discussion started by: mmunir
5 Replies

6. Shell Programming and Scripting

How to remove the logs more than 5 days old

All, How to remove the logs that are more than 5 days old from a particular folder. Help will be highly appreciated. Regards Oracle User (2 Replies)
Discussion started by: Oracle_User
2 Replies

7. Shell Programming and Scripting

Delete a file after 3 days

Hi.. Am using diff to compare 2 directories(A & B) and as ouput i get a list of files which are found only in directory B ( I used grep & sed to create the list). Now I want to delete the files which are found only in dir B after 3 days. Please help me with this. Thanks CoolAtt (7 Replies)
Discussion started by: coolatt
7 Replies

8. UNIX for Advanced & Expert Users

how to archive logs older than 5 days & then delete them?

My code is tar -cvf logs.tar `find /usr/openv/logs/512*.log -mtime +2` && find *.log* -mtime +2 -exec rm {} \; this gives me output as: tar: Missing filenames:confused: (1 Reply)
Discussion started by: timus1980
1 Replies

9. Shell Programming and Scripting

Delete old logs

Hello All, We have a directory where we have old archived logs. They are numbered <logfile>.log.1 till <logfile>.log.100 or more. I just want to keep 10 log files and delete others through the script. Please advise. Thanks, Chiru (4 Replies)
Discussion started by: chiru_h
4 Replies

10. UNIX for Dummies Questions & Answers

How to delete files over 30 days

I have a directory that contains files. I would like the command that deletes all files that are over 30 days old. Delete files based on creation date and not modified. (2 Replies)
Discussion started by: GEBRAUN
2 Replies
Login or Register to Ask a Question