I love the -newerct flag for the Cygwin find command on windows.
Can I use "/usr/bin/find . -newerct '3 hours ago'" to conditionally copy a directory tree so that only the files in the directory tree that are younger than 3 hours are copied to my destination directory such that the directory structure is preserved?
Can someone give me a sample /usr/bin/find command (or some other utility) that will only recreate those parts of the directory tree on a different memory stick that are younger than 3 hours?
This command does not recreate the directory structure
/usr/bin/find . -type f -newerct '8 days ago' -exec cp {} /cygdrive/c/deleteme.txt \; -print
This code correctly finds the one file in the directory structure. It is in a great-grandchild directory. It copies the file to the top level directory with a file name of deleteme.txt instead of creating a directory tree called deleteme.txt with the child, grand child and great grand child sub-directories.
List the results - don't cp yet. Then, go through the list, separate the directories from the path, and use mkdir -p to create it. Then only you can copy...