0

How do I exclude a folder when using rsync ?

rsync -i /home/kong/.ssh/id_rsantu --exclude /media/kong/Elements/sgan/dataset/ /media/kong/Elements/sgan/ kongserver@35.123.456.78:~/

And this is the message I got. But I went into the server and did not see the copied file.

skipping directory .
<f..T...... id_rsantu

I included --exclude= but it is still copying from /media/kong/Elements/sgan/dataset/ because I see

<f+++++++++ dataset/train/Ouchy-2-Left-crops/crossing/0000000159/0000012818.png
<f+++++++++ dataset/train/Ouchy-2-Left-crops/crossing/0000000159/0000012819.png
<f+++++++++ dataset/train/Ouchy-2-Left-crops/crossing/0000000159/0000012820.png
<f+++++++++ dataset/train/Ouchy-2-Left-crops/crossing/0000000159/0000012821.png
  • The syntax is --exclude=PATTERN, you missed an = there – Jos Nov 29 '18 at 11:23
1

you need to use -r flag: rsync -r -i /home/kong/.ssh/id_rsantu --exclude /media/kong/Elements/sgan/dataset/ /media/kong/Elements/sgan/ kongserver@35.123.456.78:~/

from man rsync: -r, --recursive recurse into directories

  • but its still copying stuff from /media/kong/Elements/sgan/dataset/ – Kong Nov 29 '18 at 11:25
  • 1
    that's becasue your exclude should only include path of the copied path: --exclude dataset/ because /media/kong/Elements/sgan is where the sync starts – janmyszkier Nov 29 '18 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.