Ole*_*Ole 7 search rsync restore
我不小心 rsynced .thunderbirdtouser@host而不是 to user@host:/home/user。
.thunderbird现在在哪里?有没有搜索文件夹的好方法?
mur*_*uru 13
它位于您运行命令的目录中:
$ touch foo
$ ls -l foo bar@baz
ls: cannot access 'bar@baz': No such file or directory
-rw-rw-r-- 1 muru muru 0 May 30 16:53 foo
$ rsync -aP foo bar@baz
sending incremental file list
foo
0 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/1)
$ ls -l foo bar
-rw-rw-r-- 1 muru muru 0 May 30 16:53 bar@baz
-rw-rw-r-- 1 muru muru 0 May 30 16:53 foo
Run Code Online (Sandbox Code Playgroud)
如果您这样做了rsync .thunderbird user@host:而没有rsync .thunderbird user@host(注意:),则该目录将被复制到useron的主目录host(因此/home/user在 中通常是多余的user@host:/home/user)。如果没有:,第二个参数只是本地系统上目标目录的路径。
这同样适用于scp.
请注意,rsync除非您告诉它,否则不会删除源文件。所以.thunderbird仍然是它原来的地方,并且在它被复制到的任何地方都会制作一个新副本。
另请注意,rsync根据源目录是否有尾随/. 这两个是不同的:
rsync -aP .thunderbird somewhere
rsync -aP .thunderbird/ somewhere
Run Code Online (Sandbox Code Playgroud)
在第一种情况下,该.thunderbird目录将被复制somewhere,但在第二种情况下,内容的.thunderbird复制(所以你不会看到somewhere/.thunderbird,但如果有一个.thunderbird/foo,你会看到somewhere/foo,而不是somewhere/.thunderbird/foo)。