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/ [email protected]:~/

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
1
  • The syntax is --exclude=PATTERN, you missed an = there
    – Jos
    Nov 29, 2018 at 11:23

1 Answer 1

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/ [email protected]:~/

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

2
  • but its still copying stuff from /media/kong/Elements/sgan/dataset/
    – Kong
    Nov 29, 2018 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 Nov 29, 2018 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .