Rsync 复制目录内容但不是目录本身 [英] Rsync copy directory contents but not directory itself

查看:47
本文介绍了Rsync 复制目录内容但不是目录本身的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试同步两个名称不同的文件夹内容:

I'm trying to synchronize two contents of folders with different name:

rsync -av ~/foo user@remote.com:/var/www/bar

我想将 foo 的内容复制到远程主机的 bar 中,而不是目录 foo 本身.我尝试过类似 foo/* 的东西,但 rsync 不支持.

I'd like to copy the content of foo into bar at remote host, but not the directory foo itself. I've tried something like foo/*, but rsync doesn't support that.

rsync 总是创建

rsync always creates

/var/www/bar/foo

推荐答案

rsync 将带有 no 尾随斜杠的目录解释为 copy this directory,以及一个目录 结尾的斜杠作为复制这个目录的内容.

rsync interprets a directory with no trailing slash as copy this directory, and a directory with a trailing slash as copy the contents of this directory.

试试rsync -av ~/foo/user@remote.com:/var/www/bar/

这篇关于Rsync 复制目录内容但不是目录本身的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆