1

We use a third party newsletter system which updates frequently, usually around 100 files. Each time all the developers release is the whole application again with a changelog but there's usually too many files listed for it to be useful. The system - once online - generates a lot of files (caches etc) so i dont want to download the remote files to do a local diff each time either. What i want to do is upload the zip of all the newly released files and run a Diff (or similar) and copy over from new_files -> existing_files just the updated files and ignore the files in existing that aren't in new. Whats the best way to do this?

I know this can be achieved to an extent using copy but its my understanding that this is largely based on last edited date but i'm more interested in actual file differences

This is on CentOS 5 and i have shell access

Thanks.

robjmills
  • 990
  • 9
  • 26
  • You did not mention which operating system you are working with. Also do you have command line access to the remote system if it is *nix based? Also, if the new and old files are the same, what is the harm of overwriting all of the files? – Dave Drager Jun 19 '09 at 14:31
  • yep, should have said this is on CentOS and I have shell access – robjmills Jun 19 '09 at 14:38

2 Answers2

4

With linux, ssh in and use rsync

this will help

http://troy.jdmz.net/rsync/index.html

MathewC
  • 6,957
  • 9
  • 39
  • 53
  • yeah, as soon as i posted the question i started to think about why i'm not just doing this with rsync. is there any good reason why i shouldnt? a better option ? – robjmills Jun 19 '09 at 14:39
  • 1
    This was going to be my answer as well - Use the -c (--checksum) which creates md5 hashes I believe, so that you are not using the file change date. – Dave Drager Jun 19 '09 at 14:45
  • SSH and rsync will give you security and a solid repeatable solution. I think it's the way to go. ;-) – MathewC Jun 19 '09 at 14:47
  • yes, this definitely makes the most sense the more i think about it – robjmills Jun 19 '09 at 14:51
  • Awesome ::cough click the check mark cough:: I'm glad this will work for you. ;-) – MathewC Jun 19 '09 at 15:08
  • ::cough:: what a blatant badge request... Good answer and plus 1. – oneodd1 Jun 19 '09 at 22:19
1

rsync? rsync uses hashing to determine changes andthen syncs the diffs.

Jason Tan
  • 2,752
  • 2
  • 17
  • 24
  • 1
    yes, that seems to be the best option. not sure what the best command would be to run so looking into this now, got this so far: rsync -c -av --stats --progress newfiles/ oldfiles/ – robjmills Jun 19 '09 at 15:24