1

I need to find the meaning of the below statement:

find /sourcedirectory -mtime +2 -exec mv "{}" /destination/directory/ \;
2
  • 1
    Next time, please specify which Unix you're talking about. (Or as in this case, which find.) AIX is not FreeBSD is not OS X, for example. – user Aug 12 '14 at 13:09
  • 1
    Also, the title and the question do not match. – user Aug 12 '14 at 13:10
7

It means that every file or folder under /sourcedirectory older than two days should be moved to /destination/directory/.

find /sourcedirectory           # finds every file/folder
-mtime +2                       # sort out files/folders older than 2 days
mv "{}" /destination/directory/ # move each result to destination folder

Your Answer

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