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, 2021 at 2:04
  • This looks something different to my requirement... I wanted to move directories and folders from source to destination.
    – nasa
    Feb 19, 2021 at 2:23
  • Create a file with a timestamp of midnight, then use find -newer. Feb 19, 2021 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, 2021 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, 2021 at 23:34

1 Answer 1


You need daystart if you want to catch all files up to yesterday 23:59 o'clock:

Measure times (for -amin, -atime, -cmin, -ctime, -mmin, and -mtime) from the beginning of today rather than from 24 hours ago. This option only affects tests which appear later on the command line.


find /temp/source/* -daystart -mtime +0

Or of you want all files only of today

find /temp/source/* -daystart -mtime 0

Or all files only of yesterday

find /temp/source/* -daystart -mtime 1

You can even define a specific range of days like all files of yesterday and the day before yesterday:

find /temp/source/* -daystart -mtime +0 -mtime -3

PS You should consider -mindepth 1 instead of globbing (*) the subdirectories to find.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .