![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| way to copy only changed files | zuessh | AIX | 3 | 12-15-2006 11:41 AM |
| chmod command for recently modified files | polka_friend | UNIX for Dummies Questions & Answers | 2 | 08-30-2006 12:25 PM |
| How to compare two flat files and get changed data | jtshashidhar | Shell Programming and Scripting | 3 | 01-29-2006 06:26 PM |
| shortcut for recently used commands in csh | RishiPahuja | UNIX for Dummies Questions & Answers | 1 | 04-20-2005 01:01 AM |
| Recently Announced TCP Vulnerability | Perderabo | News, Links, Events and Announcements | 0 | 04-23-2004 04:38 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
|||
|
Thank you
Thank you, I ended up doing something like this.
Quote:
Last edited by scotbuff; 01-19-2007 at 11:38 AM. |
|
|||
|
find . -mtime -1 -depth -print | cpio -pdmuv ../common
The -o and -p option don't go together. By using the -depth option the directories will have to same time stamp as the original directory. Basically in this way the directory is copied after the files below it. (Ofcourse the directory is created before, but permissions and access rights, time stamps are copied after). When doing it the other way around, copying the file will result in the timestamps of the directory to be changed. |