Eoin O'Sullivan
2006-Jun-24 12:58 UTC
Creating a third difference-only folder using rsync to compare 2 folders
I cannot find a clear answer to the following question ... I have 2 local websites on my LAN with 1,000+ files incl subdirectories & 300Mb+ size. I am using rsync to update 1 folder based on changes in the other folder however I also need to compile a 2nd copy of ONLY the files that have changed and put these in a 3rd folder so I can FTP them to a live website (which doesn't support rsync). How can I do this with rsync?? Or is there another way, I am using OSX. Folder A (contains website with some changes) Folder B (contains older version of website) Folder C (should contain only the files/folders that are different between A & B) How I think it should work .... Compare Folder A to Folder B ... Any differences to be copied to Folder C. Then Update Folder B with changed files from Folder A (this is working OK) Any tips, solutions appreciated. Thanks Eoin -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.3/374 - Release Date: 23/06/2006
Wayne Davison
2006-Jun-24 17:39 UTC
Creating a third difference-only folder using rsync to compare 2 folders
On Sat, Jun 24, 2006 at 01:51:20PM +0100, Eoin O'Sullivan wrote:> I am using rsync to update 1 folder based on changes in the other folder > however I also need to compile a 2nd copy of ONLY the files that have > changed and put these in a 3rd folder so I can FTP them to a live > website (which doesn't support rsync).That's the purpose of the --compare-dest option. Do the copy from a source dir to an empty dir using the last-copied destination dir as the arg for --compare-dest. Only changed files will be placed into the destination. After ftping them to the live website, you can move them into the last-copied destination dir and repeat. If you need to know about deleted files, you'll need to do one additional copy after this that only deletes files in the updated destination by using both the --existing and the --ignore-existing options along with --delete (this avoids doing any file transfers). If you make a note of what files get deleted (by using a script to scan the output), you can duplicate those deletions on the ftp site.> Folder A (contains website with some changes) > Folder B (contains older version of website) > Folder C (should contain only the files/folders that are different > between A & B)The following presumes A, B, and C are all in the same dir. Use full paths as needed if they are not: rsync -av --compare-dest=../B A/ C # ftp each file from C to remote site and move it into B. rsync -av --existing --ignore-existing --delete A/ B | tee dels # perform deletions mention in "del" on remote site. ..wayne..