Visit Our UNIX and Linux User Community

Script to remove log files

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to remove log files
# 1  
Old 03-02-2006
Script to remove log files

Can anyone help me with a shell script to remove all files (log files) created 7 days before current system date.

# 2  
Old 03-02-2006
Sorry a bit of google helped me to write the following.

/usr/bin/find / -name *.log -ctime +7 -exec /bin/rm -f {} \;

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove excess log files past data mark

I have got application log files collecting up fast inside of a directory. The logs contains many logs that look like this (were talking 1000s+): the Log_NAME followed by Date and application specific nonsense. (...) application_log_2014-07-13_20-30-09 ... (4 Replies)
Discussion started by: Samuel12
4 Replies

2. AIX

Script to remove backup files

HI, I want to remove my backup files keeping last 30 days. Now i am doing it manually. Does anyone have a script to automate this process? Thanks in advance (5 Replies)
Discussion started by: ElizabethPJ
5 Replies

3. UNIX for Dummies Questions & Answers

Pls. help with script to remove million files

Hi, one of the server, log directory was never cleaned up. We have so many files. I want to remove all the files that starts with dfr* but I get error message when I use the *. rm qfr* bash: /usr/bin/rm: Arg list too long I am trying to write this script but not working. ... (4 Replies)
Discussion started by: samnyc
4 Replies

4. Shell Programming and Scripting

Can you extract (remove) lines from log files?

I use "MineOS" (a linux distro with python scripts and web ui included for managing a Minecraft Server). The author of the scripts is currently having a problem with the Minecraft server log file being spammed with certain entries. He's working on clearing up the spam. But in the meantime, I'm... (8 Replies)
Discussion started by: nbsparks
8 Replies

5. Shell Programming and Scripting

Script to mv files and then remove

Hi Guys i'm looking for some help with creating a scripts: Background - I run alot of testing which creates huge files. This fills up the diskspace over 3 weeks so needs constant deleting. but generally, I keep forgetting!!! so every 3 weeks it fails lol. Basically i can't format the drive... (2 Replies)
Discussion started by: defamer
2 Replies

6. Shell Programming and Scripting

Shell script to remove files

I am working in directory week5 and I want to delete the files in directory week1, without leaving directory week5. I understand that rm is used to delete a file, but how do you remove them while working in a different directory. I also only want to delete a certain set of files *. (1 Reply)
Discussion started by: smiley76112
1 Replies

7. Shell Programming and Scripting

script to remove files older than 60 days

Hi I need help in the script which looks at a contorl file which has a list of file names like xxxx.12345 and I want to take only xxxxx and search in a specific directory and remove the file if its older than 60 days I have written something like this.. but seems to be wrong... (1 Reply)
Discussion started by: antointoronto
1 Replies

8. Shell Programming and Scripting

shell script to remove old files and write to a log file

Hi, I have a script that works on a unix box but am trying to get it working on a linux box that uses shell. I am not a programmer so this is proving harder than I imagined. I made some changes and ended up with the script below but when I run it I get the following messages. Any help would be... (4 Replies)
Discussion started by: yabai
4 Replies

9. Solaris

Find 3 months old log files and remove

HI I HAVE LOG FILES IN THIS FORMAT XXX.log.20080509215745 XXX.log.20080209205745 XXX.log.20080301785745 XXX.log.20080109155745 XXX.log.20080409115745 XXX.log.20080309105745 I NEED TO FIND THE FILES FROM 3 MONTHS OLD AND REMOVE PLEASE HELP THANKS, (13 Replies)
Discussion started by: cvdev
13 Replies

Featured Tech Videos