[mdlug] Proper rsync syntax
Carl T. Miller
carl at carltm.com
Tue Jun 16 06:40:04 EDT 2020
Your suspicions about a missing slash are right. If
the source folder does not have a trailing slash,
the folder itself is copied. If the source folder does
have a trailing slash, the contents are copied.
And it doesn't matter whether or not the destination
has a trailing slash.
The easiest way to fix this is like this:
cd /mnt/Workspace/sdb2
mv `ls -Aq` ..
cd ..
rm -r sdb2
Good luck!
c
On 6/15/20 9:08 PM, email5000 at usa.com wrote:
> I 'rsynced' a root directory from one NAS drive to another drive in the
> same NAS box, but I think I made a mistake in my syntax. The 'from'
> drive is referenced as /mnt/sdb2, and the other we'll call
> /mnt/Workspace. The intent is to have the root of sdb2 as the root of
> Workspace, but what happened is that rsync copied the folder (i.e.
> partition) sdb2 over to Workspace, and now I have an extra level of
> hierarchy in Workspace, with an empty root partition in the destination
> drive except one folder called sdb2. That is: the content of destination
> root folder sdb2 contains what I want to be the root of the destination.
> I realize that it's not critical, but I don't particularly want a folder
> in the root of Workspace called sdb2, and the extra hierarchy just makes
> it obsolete/redundant.
>
> With the pwd as: /mnt, I think my syntax was: rsync -tvr ./sdb2
> ./Workspace
>
> Did I miss a slash somewhere ... like after sdb2 ?
>
> My thinking to fix this is either 'move' all of sdb2 back to the root,
> or simply wipe the sdb2 folder and go again with rsync. I'm thinking
> there is not a quicker, easier way to do this.
>
> Comments?
>
> BTW: For future reference, what is the proper rsync syntax to copy the
> 'contents' of a folder over without copying the folder name itself?
>
> Thanks.
> -Rich Hall
>
>
>
>
> _______________________________________________
> mdlug mailing list
> mdlug at mdlug.org
> http://mdlug.org/mailman/listinfo/mdlug
>
More information about the mdlug
mailing list