find and cp with directory structure.

Wipe_Out wipe_out at users.sourceforge.net
Mon Oct 24 10:41:10 UTC 2011


Hi,

I am trying to keep a directory with only the files that have changed in the
last 30 days (nothing earlier).. I am trying this command..

find /mnt/Scheduling/ -type f -mtime -30 -exec cp -r {}
/home/ftpuser/attendance_registers/ \;

I have tried with and without the "-type f" option but it only copies the
files from all directories of the source to the root of the destination..
Even using "cp -r" made no difference because obviously find is just passing
the filename to the cp command..

rsync is no good because I can't limit it to getting files that have changed
in the last 30 days only..

Anyone have any suggestions how I can replicate the directory structure as
well?

TIA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20111024/ad8e96ee/attachment.html>


More information about the ubuntu-users mailing list