rsync using part of a relative path

Lagrangian

Suppose I have a directory on a local machine, behind a firewall:

local:/home/meee/workdir/

And a directory on a remote machine, on the other side of the firewall:

remote:/a1/a2/.../aN/one/two/
remote:/a1/a2/.../aN/one/dont-copy-me{1,2,3,...}/

...such that N >= 0.

My local machine has a script that uses rsync. I want this script to copy only one/two/ from the remote machine for a variable-but-known 'N' such that I end up with:

local:/home/meee/workdir/one/two/

If I use rsync remote:/a1/a2/.../aN/one/two/ ~/workdir/, I end up with:

local:/home/meee/workdir/two/

If I use rsync --relative remote:/a1/a2/.../aN/one/two/ ~/workdir/, I end up with:

local:/home/meee/workdir/a1/a2/.../aN/one/two/

Neither one of these is what I want.

  1. Are there rsync flags which can achieve the desired result?
  2. If not, can anyone think of a straightforward solution?
rudimeier

For -- relative you have to insert a dot into the source directory path:

rsync -av --relative remote:/a1/a2/.../aN/./one/two ~/workdir/

See the manual:

-R, --relative

[...]

It is also possible to limit the amount of path information that is sent as implied directories for each path you specify. With a modern rsync on the sending side (beginning with 2.6.7), you can insert a dot and a slash into the source path, like this:

             rsync -avR /foo/./bar/baz.c remote:/tmp/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Relative path using "./"

From Dev

Using relative path

From Dev

Setting a hyperlink using a relative path

From Dev

Relative Path Using imread (OpenCV)

From Dev

Upload only modified part of file using rsync

From Dev

rsync isn't understanding what is the relative part in --files-from=FILE

From Dev

Batch - copy file using relative path

From Dev

Difference between relative path and using $ORIGIN as RPATH

From Java

Reading file using relative path in python project

From Java

Using a Relative Path for a Service Call in AngularJS

From Dev

possible to use relative path using css in webdriver?

From Dev

Reading file using relative path in python project

From Dev

Batch - copy file using relative path

From Dev

Difference between relative path and using $ORIGIN as RPATH

From Dev

Opening files by relative path on Windows using C

From Dev

How to move home using relative path

From Dev

Load multiple files using a relative path in a for loop

From Dev

Using a relative path for saving my binary file cannot find the path

From Dev

Using clip-path as part of header

From Dev

How to replace part of a path using cmd?

From Dev

rsync cannot exclude relative files?

From Dev

Open an xml document in Internet Explorer using a relative path in C#

From Dev

Symfony: Is there any way to render a twig template using a relative path to the template?

From Dev

Using relative Image path in Angular 2 and ASP.NET Core

From Dev

PowerShell: Run script from shortcut using relative path

From Dev

Difficulty in using SDL_LoadBMP with relative path in Xcode

From Dev

Unable to include relative path file using Jade Template

From Dev

Get File using relative path play framework 2.2 java

From Dev

Selenium webdriver upload download files using relative path

Related Related

  1. 1

    Relative path using "./"

  2. 2

    Using relative path

  3. 3

    Setting a hyperlink using a relative path

  4. 4

    Relative Path Using imread (OpenCV)

  5. 5

    Upload only modified part of file using rsync

  6. 6

    rsync isn't understanding what is the relative part in --files-from=FILE

  7. 7

    Batch - copy file using relative path

  8. 8

    Difference between relative path and using $ORIGIN as RPATH

  9. 9

    Reading file using relative path in python project

  10. 10

    Using a Relative Path for a Service Call in AngularJS

  11. 11

    possible to use relative path using css in webdriver?

  12. 12

    Reading file using relative path in python project

  13. 13

    Batch - copy file using relative path

  14. 14

    Difference between relative path and using $ORIGIN as RPATH

  15. 15

    Opening files by relative path on Windows using C

  16. 16

    How to move home using relative path

  17. 17

    Load multiple files using a relative path in a for loop

  18. 18

    Using a relative path for saving my binary file cannot find the path

  19. 19

    Using clip-path as part of header

  20. 20

    How to replace part of a path using cmd?

  21. 21

    rsync cannot exclude relative files?

  22. 22

    Open an xml document in Internet Explorer using a relative path in C#

  23. 23

    Symfony: Is there any way to render a twig template using a relative path to the template?

  24. 24

    Using relative Image path in Angular 2 and ASP.NET Core

  25. 25

    PowerShell: Run script from shortcut using relative path

  26. 26

    Difficulty in using SDL_LoadBMP with relative path in Xcode

  27. 27

    Unable to include relative path file using Jade Template

  28. 28

    Get File using relative path play framework 2.2 java

  29. 29

    Selenium webdriver upload download files using relative path

HotTag

Archive