0

i can recursivly find and copy all my test-directories (with content) of the current directory:

find . -name test ! -path "./my_dest/*" -exec cp -r --parents {} /path/to/my_dest  \;

But now I want to copy only that test-directories (with content), which content was changed within the last 24 houres.

What do I have to add to my line above?

Edit: I want to have the same results as my find-line above, but I want only that entries in my result, in which folders a folder or a file has been changed within the last 24hours (or something else).

The line

find . -name test ! -path "./my_dest/*" ! -ctime +0 -exec cp -r --parents {} /path/to/my_dest  \;

does not do that! This line would find&copy only the folderchanged test-folders but not the filechanged test-folders.

Dudi Boy
  • 4,551
  • 1
  • 15
  • 30
Cap
  • 57
  • 7
  • Possible duplicate of [Find the files that have been changed in last 24 hours](https://stackoverflow.com/questions/16085958/find-the-files-that-have-been-changed-in-last-24-hours) – oguz ismail Apr 06 '19 at 12:05
  • 1
    @oguzismail: NO, it isnt a duplikate of that post!! Where is our conversation gone??!! Btw: If I add a new folder to one of my test-folders, than your code was working fine... but I didn't want to get the folders with changed folders, but I want to get the folders with changed files also... – Cap Apr 06 '19 at 12:24
  • btw: That possible duplikate is some months ago and it is a completly other problem...(and none of the difficult ones ;) ) – Cap Apr 06 '19 at 12:28

1 Answers1

0

You use the rsync command built specifically for this task. Here is the documentation and the manual page.

Dudi Boy
  • 4,551
  • 1
  • 15
  • 30