Is there a way to copy folders and its contents with specific modification date in Linux, for example I have this folder A and B it contains files with modified date 2015-01-01
to 2015-01-18
, is it possible to copy folder A and B containing only files modified on 2015-01-01
to 2015-01-08
?
I did some research and came up with this
find ./ -type d -exec mkdir -p {} $target{} \;
find $source -mtime +30 -exec cp -p "{}" $target \;
but after executing the 2nd line, files will be copied to the root directory on target location, not in the same structure as the source
for example i have this source directory to be copied on the target
/storage/subdir1/* (modified date range - 2015-01-01 to 2015-01-18)
/storage/subdir2/* (modified date range - 2015-01-01 to 2015-01-18)
/storage/subdir3/* (modified date range - 2015-01-01 to 2015-01-18)
/storage/subdir4/* (modified date range - 2015-01-01 to 2015-01-18)
would it be possible that in the target directory (/targetdir/) all sub directories will be created automatically and it contains only files with modified date (2015-01-01 to 2015-01-08)
John