Skip to content

Instantly share code, notes, and snippets.

@andmax
Last active July 28, 2020 10:45
Show Gist options
  • Save andmax/f63a9406f87f4fb8e0b12dc0adeb7237 to your computer and use it in GitHub Desktop.
Save andmax/f63a9406f87f4fb8e0b12dc0adeb7237 to your computer and use it in GitHub Desktop.
Command rsync is more powerful than scp to copy between servers
1- The problem is to copy all files with 3D in their file name
2- From and to specific directories, going recursively, with:
3- -m == --prune-empty-dirs (skip empty directories)
4- -a == --archive -r (do recursion preserving folder structure)
5- -z == --compress (do compression)
6- -v == --verbose (do verbose)
7- It is very important to set the /path/from and /path/to properly,
8- e.g. source path is /dir1/dir2/dir3/dir4 and the intention is to
9- preserve dir3/ forward in the backup so the destination path is
10- /dirA/dirB/dir3/, note that there is no slash at the end of dir4(/)
11- and there is a slash at the end of dir3/, this is intentional to
12- consider dir4 as the source object to be copied and dir3/ as the
13- destination object to store the source object:
$ rsync -marvz --include="*/" --include="*3D*" --exclude="*" from-server:/path/from /path/to/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment