![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell script to search for text in a file and copy file | imeadows | UNIX for Dummies Questions & Answers | 9 | 11-12-2008 09:12 PM |
| Noob on Unix. | bobtheb | UNIX for Dummies Questions & Answers | 7 | 07-10-2008 07:56 AM |
| how to copy a file to a directory ,where file and dir are sent as args to a function? | wrapster | Shell Programming and Scripting | 0 | 06-08-2008 08:37 AM |
| Script to capture new lines in a file and copy it to new file | fara_aris | Shell Programming and Scripting | 0 | 05-27-2008 11:11 PM |
| complete noob | avdrummerboy | UNIX for Dummies Questions & Answers | 3 | 12-04-2006 12:25 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help. noob needs help with file copy!
So I have a very simple question that has come to be a huge headache.
I need to copy files from FolderA into FolderB replacing all files that already exist in FolderB UNLESS the date of the file in FolderB is newer than the date from the same file in FolderA. In the case that file is newer in the destination, I need to skip copy of that file and move on. I have tried so many different things and nothing has been able to do what I need. I have tried a simple cp -i but i need to filter by date and choose "don't overwrite" if file being copied is older, but owverwite is file date is same. there is a long story to go along with this as well. Thanks in advance |
|
||||
|
Thank you danmero for the rsync pointer.
cp -u does not work in OS 10.5 for some reason. I haad looked at that before. So rsync looks like what i need. I ran some "dry-runs" with it and also some test runs. using this convention: $ rsync -vru --progress FolderA/ FolderB/ It only copies files from FolderA that are newer than files in FolderB. It skips files that are the same size or date. This is an expect from the rsync man page: -u, --update This forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file. (If an existing destination file has a modification time equal to the source file's, it will be updated if the sizes are different.) So what i need to do is force rsync to use update to copy a file if it is equal or newer. NOT if it is ONLY newer. Any ideas here? |
|
||||
|
Quote:
Not so. Now for the long story. Ok a really short version of the long story. We have a San Server with 43TB of user data. We backed said san server using some software to a backup san drive. We wiped the orginal san drive. Used the same software to restore the backup san drive contents to the live san drive. Months later after users had been using the directoires on the san server, they start complaining of random files being corrupt when they open them. After manualy draging and droping the old backup file form the backup san over the (same exact date and size) file in the live san, the file works for them. The files are random that are corrupt so we need to copy all the files that exist in the backup drive into the live drive overwriting the files if they exist but ONLY if the file date is equal of older than what is there as users have been updating files and adding to the directories. whew. and that was the short version. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|