Issue
Pardon my novice-ness, please.
A question regarding the usage of Rsync. If I specify, as an example, this command:
rsync -av Downloads Downloads2
the result is that the directory "Downloads2" is created with "Downloads" as a subdirectory, and, within /Downloads2/Downloads are all of the contents of the original /Downloads directory.
I am wondering if there is an option which will cause rsync to copy the contents of /Downloads to /Downloads2 without creating the /Downloads2/Downloads structure?
Solution
As you can see from "man rsync", adding a trailing slash on the source directory will prevent that directory being created:
rsync -avz foo:src/bar/ /data/tmp
A trailing slash on the source changes this behavior to avoid creating
an additional directory level at the destination. You can think of a
trailing / on a source as meaning "copy the contents of this directory"
as opposed to "copy the directory by name", but in both cases the
attributes of the containing directory are transferred to the contain‐
ing directory on the destination. In other words, each of the follow‐
ing 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
Answered By - mc110 Answer Checked By - Candace Johnson (WPSolving Volunteer)