0

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/ {} \;
berndbausch
  • 973
  • 7
  • 11
nasa
  • 1
  • 2
  • Take a look at this question on stack overflow. https://stackoverflow.com/questions/13902104/moving-files-older-than-one-day – suchislife Feb 19 '21 at 02:04
  • This looks something different to my requirement... I wanted to move directories and folders from source to destination. – nasa Feb 19 '21 at 02:23
  • Create a file with a timestamp of midnight, then use `find -newer`. – berndbausch Feb 19 '21 at 04: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 '21 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 '21 at 23:34

0 Answers0