I need to transfer files across ssh to another server. The file structures are identical on both sides. I have used scp -r but that does not retain the orginal file/dir permissions. rsync does the job of keeping the permissions in tact but does not delete the files on the destination side if I want to overwrite them because of changes. I know rsync will write the changes when the source files are newer but I need it to just copy everything reguardless of the date (ie replace destination directory with the one I am moving) without having to shell into the destination first and manually delete the dir.
I heard tar can do this but I can not seem to get it to work without errors. The syntax is
tar -cf - /directory/directory | ssh host.name tar -xf - C /destination_directory
Any help would be appreciated.