Rsynch and SSH: Only rename folder when renamed from source

rsync

I have been reading the rsync documentation for a few hours, but I can't figure out how to convey to rsync how to only rename (and not re-upload folder and it's content) destination folders when they are renamed at the source.

I'm connecting to the destination with SSH, and the local folder is the source — and the remote server is the destination. If I rename a folder containing files, rsync automatically re-uploads all the content of the source folder. I'm not using the rsync's server part, maybe it will works if were to do that ?

I have encountered the same behavior with lftp, and this tool doesn't seem's to have these options. Even if it is based on the file's date rule, files inside the renamed folder are removed/re-uploaded.

Thanks in advance if someone knows how to manage this 🙂

Best Answer

I've been looking for something similar.

so far, the best solution I have found is at:

http://serenadetoacuckooo.blogspot.com/2009/07/rsync-and-directory-renaming.html

It basically mentions including a meta-file in each folder that indicates the folder's name.
Essentially, you would want to check that file with the directory name, and rsync only if they are the same (otherwise, issue a remote rename command.)

It depends on the scope of what you're using rsync for, but I hope that this information can help you.

Related Topic