|
Trying to Copy Files Changed Recently
I have been toying around with a script that will copy all files altered in a development directory over to a testing directory and have been trying to construct the command to meet my needs.
Basically I am using find in a directory to see what files have changed over the past 24 hours. Then if I find any files that have changed I want to copy it over to another directory maintaining permissions. I have been toying with both these commands.
cd /home/common-dev
find . -mtime -1 |xargs cp -p {} ../common
I am getting errors about files not being directories so i must have something off with my cp command or how I am understanding how xargs is passing the filename.
cd /home/common-dev
find . -mtime -1 | cpio -opmvd ../common
The cpio command is not retaining permissions but it is doing the copies great.
Any suggestions or enlightenment would be appreciated. Thanks in advance.
|