开发者

Rsynch and SSH: Only rename folder when renamed from source

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开发者_JAVA技巧 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 :)


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.


How would rsync or any other program know what constitutes renamed? What if two directories are very similar candidates and somehow rsync guesses maybe either one could be a rename of what went before? It's not possible. I think you're stuck with uploading everything again.

You know about the --delete option, right:

--delete delete files that don't exist on the sending side

Note also the --force option:

--force force deletion of directories even if not empty

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜