You may want to look at www.rsync.org for a file mirroring tool for unix. It is nice, It does checksums and only transfers the portions of files that have changed also it is fairly secure. It also comes with many unix flavors now. There may not need to be any reason to reinvent the wheel here. just my 2 cents.