Move log files with date and delete older than 3 weeks
I have written a script which generate one logfile on every sunday and thursday
I want to move the older log files into /tmp directory befor generating new one so i used mv command like
2) But when i move this file to /tmp it will replace the older one.. So i want that logfile name should be changed befor moving /tmp
log file name should contain date
for example. logfile_9May13
3) Also i dont want to keep the logfiles into /tmp directory which are more than 3 weeks older.
Can anyone help me to achive theses two things into my script.?
If there are 100 files created in a directory /data/ today from 2:00 AM to 10:00 AM
I need to move files older than 3:00 AM to a new directory /hold/
How to do that?
Also, if I have to move files between 3:00 AM to 9:00 AM, how to achieve that (3 Replies)
Hi,
I need a command for deleting all the compress files *.Z that are older than the current date - 5 days. Basically I have a directory where daily I meet some back up files and I want to remove automatically the ones 5 days (or more) older than the current date. How can I write a 'rm' command... (1 Reply)
To delete log files content older than 30 days and append the lastest date log file date in the respective logs
I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs
This is my script
cd... (2 Replies)
Hello,
I have a script which finds files in a directory that are older than 30 days and moves them to the specified directory.
The problem is I don't know why it works the way it does?
Code:
find . -name '*.sql' ! -mtime -30 -exec mv '{}' /dataload/archivelogs \;
I was under the... (4 Replies)
Hi
I am facing problem in using this command,
mv `find /export/june/PURGEDATA*.txt -mtime +2 -exec ls {} \;` june/archive/
mv: Insufficient arguments (1)
Usage: mv f1 f2
mv f1 ... fn d1
mv d1 d2
Thank you in advance (2 Replies)
hlow all
i have folder with name like this
20110512
20110601
20110602
so i want move the last 1 day to other directory for example this date 20110602 so i want move folder older 1 day from this date
20110512 -----> this folder will move to other dir
20110601-----> this folder will move... (2 Replies)
Hi, Friends,
I am writing a script to delete all the files which are there for more than 3 weeks.
I have tried this :
find /home/appl/backup -type f -mtime +21 -exec rm -f {} \;
But i am not sure if it deletes only the files in specified directory or all the directorinies in the provieded... (3 Replies)
Guys,
My log files stored in the date format format below(log_20080714072942):
TIMESTAMP=`date +%Y%m%d%H%M%S`
LOG=/log/log_${TIMESTAMP}.log
I'm looking for a shell script which deletes all files which is older than 3 months from today.
Regards,
Bhagat (3 Replies)