I copy files to another location using rsync with the option --files-from. Sometimes, a file gets deleted and is not included in that list of files any more. I tried to use --delete, but that would not delete any files that are not in the list any more.

How could I delete the files using this approach?

The point is that I only want to copy all the PDF files, files that end in .pdf. I could do that with --exclude and --include but that would require me to exclude all files, then re-include sub-directories and the PDF files. I thought that using find -name '*.pdf' as input for rsync --files-from would be a more sensible approach, until I hit that delete issue above.

  • The combination of exclude and include is the standard, perfectly cromulent way to do it. Jun 21, 2014 at 23:07


Your Answer

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

Browse other questions tagged or ask your own question.