7

I accidentally rsynced .thunderbird to user@host instead of to user@host:/home/user.

Where is .thunderbird now? Is there a good way to search for the folder?

1 Answer 1

13

It's in the directory where you ran the command:

$ 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

If you did rsync .thunderbird user@host: and not rsync .thunderbird user@host (note the :), then the directory was copied to the home directory of user on host (so /home/user would usually be redundant in user@host:/home/user). Without the :, the second argument is just the path to a target directory on the local system.

The same applies to scp.

Note that rsync does not delete source files unless you tell it to. So .thunderbird is still where it was, and a new copy is made wherever it was copied to.

Also note that rsync has different behaviour based on whether the source directory had a trailing /. These two are different:

rsync -aP .thunderbird somewhere
rsync -aP .thunderbird/ somewhere

In the first case, the .thunderbird directory is copied somewhere, but in the second case, the contents of .thunderbird are copied (so you won't see somewhere/.thunderbird, but if there was a .thunderbird/foo, you'd see somewhere/foo instead of somewhere/.thunderbird/foo).

9
  • 5
    Sigh. removes answer I was about to post
    – Rinzwind
    May 30, 2017 at 7:56
  • 1
    @Ole user@host maybe a different laptop, but without :, rsync treats it as a name for the local system. What command did you run, exactly?
    – muru
    May 30, 2017 at 8:00
  • So I ran rsync -vaz .thunderbird [email protected]
    – Ole
    May 30, 2017 at 8:01
  • The files finished, but they are not in /home/ole/.thunderbird ... so now I'm wondering where .thunderbird went ... :)
    – Ole
    May 30, 2017 at 8:02
  • 1
    Then .thunderbird was copied to a directory named [email protected] in whichever directory you ran the command.
    – muru
    May 30, 2017 at 8:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .