0

I have a task - To search 6 months old directories/files. 1) Tar and save to another location.

Below command works perfectly, but saving to same location where old files exist

find . -mtime +180 -exec tar --remove-files -jcvf {}.tar.bz2 {} \;

I tried below command to save in another location, but didn't help, can anyone help me out here.

find . -mtime +180 -exec tar --remove-files -jcf ../old_file/{}.tar.bz2 {} \;

2) To preserve same date/timing , i am trying --atime-preserve with tar, but could see still new tar file created with today's date

2
  • Please advise the distro you installed (i.e., Ubuntu Desktop, Ubuntu Server, Kubuntu, Lubuntu, Xubuntu, Ubuntu Budgie, et al.) and its version. Please click edit and add that information to your question; please do not use Add Comment. – K7AAY Feb 28 '20 at 8:42
  • directory ../old_file/{} need to exist. – bac0n Feb 28 '20 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.