tar & Zip then move the files older than 45 days
Helllo,
I have a command in crontab which moves the files older than 45 days to the archive location. what i need to do is to first tar and zip the files older than 45 days and move to the archive location. how below command will change as per my requirement. Code:
find /ABC -mtime +45 -exec mv {} /XYZ \; |
Write a script to do the whole tar / zip / move and use that instead of the
Code:
mv {} /XYZ |
Something like the following should do the job:
With tar: Code:
find /ABC -mtime +45 -exec tar -cf archive_name.tar {} + && mv archive_name.tar archive_location Code:
find /ABC -mtime +45 -exec zip archive_name.zip {} + && mv archive_name.zip archive_location |
Thnaks, how exactly the full command would be with tar,zip and move? that was my question
|
Quote:
Why does your requirement include tar&zip? These are 2 similar archive algorithms (with technical differences though) so I think you need to make a choice. Or maybe you need to make 1tar + 1zip? |
Is this homework?
|
All times are GMT -5. The time now is 03:06 PM. |