2

I have a small number of files to sync from one server to another, however there are some files I want to exclude from being synced.

I'd rather not have to add them to a --exclude pattern if I can just confirm for each file instead. Is it possible to get a prompt for each file saying something like "Sync this file? (y/N)"

1

Unison is designed to be a bidirectional rsync. You can nonetheless use it in one direction if you wish. Unison prompts you to decide what to do for each file; press > to copy forward or / to skip a file. There's also a GUI if you prefer that.

Alternatively, you can link the files into a staging area, then synchronize the stating area and clean it up.

mkdir staging
for x in files_to_mostly_copy/*; do
  printf "Copy %s? " "$x"
  read response
  case "$response" in
    [Yy]*) ln "$x" staging/;;
  esac
done
rsync -au staging/ remote_server:
rm -r staging

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.