0

Something weird happened while running an rsync command.

I first mounted a Windows share to copy files to like this:

mount -t cifs //myserver/share] /media/s

Then ran rsync command below

sudo rsync -avprP /* /media/s/Backup --exclude '/backups' '/media'

Now that I look at it, did the above rsync command not exclude /media, but actually back up to it? Guessing I put the --exclude in wrong order or syntax?

Thanks in advance.

1

Yes, --exclude only takes a single argument. Try --exclude '/backups' --exclude '/media'. (Actually, you don't need the single quotes around either of those, but they don't hurt.)

  • Thank you! So would the above command explain why my entire server was copied to /media/media? I want to make sure before I delete the contents of /media/media/* :) Thanks! – 916 Networks Mar 29 '17 at 21:09
  • The existing command will copy everything under / except /backups, plus an extra copy of /media/s/Backup in addition, into bare /media. Thus, /media/media will contain a duplicate of everything that was previously under /media. You can probably delete all that, though you should make sure it's actually superfluous as a sanity check. – Tom Hunt Mar 29 '17 at 21:17

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.