- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在尝试按照以下问题中的要求做一些事情:How do I synchronize in both directions?
但是,我想不通的是我是否应该在文件路径的末尾添加斜杠。基本上我正在尝试创建一个别名命令来同步两个目录的内容,这两个目录具有相同的名称但位于两个不同的服务器上。我不希望将一个目录复制到另一个目录(我知道这是一种可能性,具体取决于末尾的斜线是如何完成的)。
我目前拥有的是:
alias syncDirectories1 = 'rsync -tvur name@host:/Users/me/directory/ /Users/me/directory/'
alias syncDirectories2 = 'rsync -tvur /Users/me/directory/ name@host:/Users/me/directory/'
对于我想要完成的事情,两个文件路径的末尾是否应该有斜杠?
最佳答案
它在 rsync(1)
中有描述手册页:
A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination. You can think of atrailing
/
on a source as meaning "copy the contents of this directory" as opposed to "copy the directory by name", but in both cases theattributes of the containing directory are transferred to the containing directory on the destination. In other words, each of the following commands copies the files in the same way, including their setting of the attributes of/dest/foo
:rsync -av /src/foo /dest
rsync -av /src/foo/ /dest/foo
至于目的地,我不认为它有任何重大后果。如果源是一个文件并且目标不存在,则存在差异 — 这将创建一个名为 DEST
的 SRC
副本:
rsync SRC DEST
,而这将创建目录 DEST
并将 SRC
文件复制到其中:
rsync SRC DEST/
关于linux - 斜杠和 rsync 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31278098/
当我使用 --progress 标志运行 rsync 时,我得到有关传输的信息,如下所示。 path/to/file 16 100% 0.01kB/s 0:00:01
为了使用单个 rsync 命令将两个源目录(例如 ~/src1 和 ~/src2)同步到远程系统中的两个独立目标(例如/tgt 和/tgt/sub_tgt),我正在做: rsync ~/src1 ui
从 rsync 手册文档中,我看到通过使用选项 rsync-path,可以指定要在远程计算机上运行的程序以启动 rsync。特别是,该程序可以是一个包装脚本,它在中间调用实际的 rsync 命令,但它
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 6年前关闭。 Improve thi
我在远程主机上有一些文件(在目录中),我想在目录级别以原子方式执行 rsync 以在本地主机上提取文件(在分布式设置中)。我能想到的一种方法是一种非常简单的情况,我可以在本地主机上进行文件备份,然后用
我们有一个 130GB 大小的文件夹,其中包含数百万个微小 (5-20k) 图像文件,我们需要将它从旧服务器 (EC2) 移动到新服务器(德国 Hetzner)。 我们的 SQL 文件 SCP 很快就
我想知道是否有一种方法(命令)可以用来查找 rsync 地址的大小,而无需开始同步? 例如,我如何找到 rsync://mirrors.standaloneinstaller.com/vim/ 的大小
我想同步/Volumes/B/中的所有内容,除了我想全局排除的缓存目录。另外,我不想 rsync 任何其他/Volume/ 我有以下排除文件: + /Volumes/B/*** - Cache/ -
rsync -av --size-only --include="*/" --include="*.jpeg" --exclude="*" ~/alg/temperature/ ~/alg/tmp/
我正在使用 rsync 同步文件夹,如果现有文件已被修改,则对其进行备份。目前所有修改过的文件都备份到一个单独的目录中,以同步时间为后缀。这是使用以下命令: rsync --times --backu
我希望 rsync 排除所有包含具有特定名称的文件的目录,比如“.rsync-exclude”,独立于“.rsync-exclude”文件的内容。 如果文件“.rsync-exclude”只包含“*”
例子: rsync /tmp/fol1/fol2/fol3/foln user@addr:/tmp/fol1/fol2/fol3/foln 我的主要问题是文件夹/tmp/fol1 在远程机器上不存在。
以下命令按预期工作... cp -ur /home/abc/* /mnt/windowsabc/ rsync 相比它有什么优势吗?有没有更好的方法让备份文件夹每 24 小时保持同步? 最佳答案 Rsy
我想从本地计算机到服务器rsync。在不存在的目录上,我希望 rsync 首先在服务器上创建该目录。 我怎样才能做到这一点? 最佳答案 如果要创建的叶目录不止最后一个,您可以先运行单独的 ssh ..
我使用 rsync 来更新我的静态网站。我目前cd到本地网站目录,运行rsync命令,然后在下一行输入密码。我已将我的 rsync 调用保存到一个文本片段中(这样 _rs 就可以扩展到我的调用)。有没
我正在运行如下命令: rsync -vuan "/Volumes/Working/foldername/" "/Volumes/Archive/foldername/" 当文件夹名称包含“/”(如“1
我尝试使用以下命令从服务器进行 rsync,并收到以下错误消息: rsync -e ssh -avz name@home.com:/home/name/. . receiving file list
所以我有这个代码: rsync \ --archive \ --verbose \ --compress \ --delete \ --no-motd \ --ex
我使用 rsync 来更新我的静态网站。我目前cd到本地网站目录,运行rsync命令,然后在下一行输入密码。我已将我的 rsync 调用保存到一个文本片段中(这样 _rs 就可以扩展到我的调用)。有没
我正在运行如下命令: rsync -vuan "/Volumes/Working/foldername/" "/Volumes/Archive/foldername/" 当文件夹名称包含“/”(如“1
我是一名优秀的程序员,十分优秀!