I am looking for some solution, where I have to move all the directories and files under the source directory to the destination a day before. I want to move the directories till yesterday but not today’s.

find  /temp/source/* -mtime +1 -exec mv -t /temp/destination/ {} \;
  • Take a look at this question on stack overflow. stackoverflow.com/questions/13902104/… – suchislife Feb 19 at 2:04
  • This looks something different to my requirement... I wanted to move directories and folders from source to destination. – nasa Feb 19 at 2:23
  • Create a file with a timestamp of midnight, then use find -newer. – berndbausch Feb 19 at 4:34
  • Have you looked into using rsync with the --include-from=FILE option, so that you can first rsync the files listed in a text file you created with find, then delete those files after you confirm the destination looks right? – Aaron Feb 19 at 17:20
  • Hi the thing is I want to move the directoriesj and each day the directory gets created with respect to the date. So I wanted to move the directories one day before which are older.. – nasa Feb 19 at 23:34

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.