Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rsync to copy folders local and remote

I'm trying to copy a directory with files and folders to another directory, first locally to test, and then to a remote server. The tool that I must use is rsync, but after a lot of testing and reading the docs I can't make it work under Windows 7.

For example, when I try

rsync -av D:\source\ D:\dest\

I get the error The source and destination cannot both be remote.

When I try rysnc -av \source\ D:\dest\, I get Error: Failed to exec ssh: No such file or directory (2)

Do you know how can I get it to work?

Thank you.

like image 231
Andrei Doanca Avatar asked Jan 28 '13 11:01

Andrei Doanca


People also ask

Does rsync sync both ways?

rsync works in one direction, so we need to run it twice to sync directories in both directions.

Does rsync copy folders?

Rsync is a command-line tool in Linux that is used to copy files from a source location to a destination location. You can copy files, directories, and entire file system and keep in sync the files between different directories.

How do I keep two directories in sync with rsync?

To sync the contents of dir1 to dir2 on the same system, you will run rsync and use the -r flag, which stands for “recursive” and is necessary for directory syncing: rsync -r dir1/ dir2.

Can you use rsync locally?

Rsync is a very useful and widely used tool that can be used to transfer or synchronize files between local and remote servers. Rsync commands are executed through the shell, so an active Linux server is required, as well as an SSH client such as Terminal or PuTTY (for Windows).


1 Answers

Cygwin paths are different, to make them Unix-like. Use

rsync -av /cygdrive/d/source/ /cygdrive/d/dest/ 

D: is interpreted as a remote server called D

like image 96
parkydr Avatar answered Oct 07 '22 13:10

parkydr