If the old and new filesystems are both accessible to your machine, then consider using a symbolic link instead of rsync. If your rsync command you're using does not specify hosts (or if they are the same host), then this is the case. You're trying to mirror two directories with a different name on the same host. Don't use rsync for this, since you are duplicating the data, and you will have to run your rsync often to keep them in sync.
Using a symbolic link is a one-time fix that will mirror two directories (with different names) and requires almost no space. It's like creating an alias directory that points to another directory.
Let's say you had the old git in a directory called /old/path/old_git and now the code repository has moved to /new/path/new_git
You can do:
cd /old/path
rm -rf old_git (if you still have it there, get rid of it, or move it out of the way)
ln -s /new/path/new_git old_git
This will create a link as such:
/old/path/old_git -> /new/path/new_git
So that anything that is put into new_git will be instantly available the old way as well, without duplicating data, and without having to constantly sync them.
src
directory underdest
directory – Zen Jan 08 '15 at 09:23rsync
I've ever used. If that's actually happening to you, you're missing the trailing slash at the end of the source directory argument. – Adrian Jan 08 '15 at 09:45dest
is a symlnk tosrc
, it instead ends up copyingsrc
tosrc/src
. Tested on macOS. Was hoping that I could replacebar -> foo/
withbar/
, but had to use an intermediate temporary directory. – user5359531 May 02 '18 at 03:25dest
is a symlink tosrc
, simplyrm dest
before running the above command.rsync
is smart enough to createdest
before copying the contents ofsrc
. You don't need an intermediate temp dir. – Adrian May 02 '18 at 16:26rsync
for Windows from Cygwin then-a
wouldn't work correctly.-a
implies a few options including-pgo
. It changes target folder's permission and you can't use it. Use commandicacls dest /T /Q /C /RESET
to reset persmissions. My command is looking as the followingrsync -rlt src/ dest
. – Maxim Suslov May 28 '18 at 00:13dest
doesn't have to exist already for this to work. – Flimm Jun 07 '22 at 15:03