Reputation: 15260
Here's my file structure:
Server_A Server_B
============== ==============
/path/dir1/ /path/dir1/
logA.txt logA.txt
logB.txt logB.txt
/path/dir2/ /path/dir2/
fileC.txt fileC.txt
fileD.txt fileC.txt
I need to rsync path/dir2 from server A to B, but not path/dir1.
My rsync command looks like this:
rsync -arv --exclude '/dir1' /path/ root@server_b:/path
But every time I run it the result shows dir1 in the print out:
sending incremental file list
./
dir1/
dir1/logA.txt
dir1/logB.txt
sent 52147 bytes received 23342 bytes 14405.50 bytes/sec
total size is 215619123 speedup is 2851.02
What am I missing?
Upvotes: 2
Views: 1297
Reputation: 311496
I'm not convinced that you've accurately transcribed the commands you're running. If I have a directory /tmp/src
that looks like this:
/tmp/src/
/tmp/src/dir1
/tmp/src/dir1/file1
/tmp/src/dir1/file2
/tmp/src/dir2
/tmp/src/dir2/file1
/tmp/src/dir2/file2
I can sync it to another server -- and exclude /tmp/src/dir1
-- like this:
rsync -av --exclude=/dir1 /tmp/src/ server:/tmp/dst/
And the run looks like this:
sending incremental file list
created directory /tmp/dst
./
dir2/
dir2/file1
dir2/file2
This appears to exactly match what you've described in your question. I'm using rsync version 3.0.8. I would advise examining both your actual rsync command line and the filesystem closely. If you don't see anything obvious, can you post the actual command you're runing, along with a top level directory listing (unless it's huge)?
Upvotes: 2