OS is Debian 10, rsync version 3.1.3. I'm running rsync like this:

time rsync -ar --delete --info=progress2 --files-from=filelist.txt . /path/to/dest

This works to copy the files over, but doesn't delete anything that's been removed. (Either removed entirely from src, or in my case, removed from filelist.txt) That is a huge problem. The only workaround I have found is to simply nuke the entire destination and just copy everything over again, but this takes a huge amount of time and basically negates the point of using rsync in the first place.

Is this a bug? How do I get rsync to work properly, honoring the --delete flag like it's supposed to?


For example:

  • If filelist.txt cotains "foo" then /path/to/dest will contain "foo".
  • If filelist.txt cotains "foo" and "bar" then /path/to/dest will contain "foo" and "bar".
  • If filelist.txt cotains "foo", "bar", and "bat" then /path/to/dest will contain "foo", "bar", and "bat".
  • etc

Assume "foo" "bar" "bat" etc are directories.

  • Is this the same as unix.stackexchange.com/q/138488/117549?
    – Jeff Schaller
    Commented Sep 15, 2020 at 2:24
  • Unclear what you mean by "been removed". Is a file removed only from the filesystem, or is it also removed from the filelist.txt?
    – BowlOfRed
    Commented Sep 15, 2020 at 5:45
  • Not the same, I have no file extension I'm trying to filter by.
    – cat pants
    Commented Sep 15, 2020 at 21:26
  • 1
    /path/to/dest should contain only directories that are listed in filelist.txt. if filelist.txt is empty, /path/to/dest should be empty also. Trivial use case.
    – cat pants
    Commented Sep 15, 2020 at 21:27

2 Answers 2


You need to tell rsync to delete the missing arguments:

rsync -arv --delete-missing-args --delete --info=progress2 --files-from=filelist.txt . /path/to/dest
  • So if you delete the directory foo it will then also be deleted in /path/to/dest with --delete-missing-args.
  • foo still needs to be listed in filelist.txt.
  • the --delete argument is required to allow rsync to delete the files in the foo folder
  • In my case, foo will be present in src, but not present in filelist.txt. I want to keep foo around, but I no longer want it to sync to dest (and thus have it removed)
    – cat pants
    Commented Sep 30, 2020 at 22:46
  • Instead of using filelist.txt - would making a hard- or symlinked copy of the directory (where you only keep the files you want to be synced) be an option?
    – laktak
    Commented Oct 1, 2020 at 9:37

No. rsync will not delete files/ dirs just because the files list do not contain those file or it is empty.

if you are using --files-from it will try to sync only the files listed from source to destination.

It will not delete the files just because they are absent from files list passed to --files-from.

For --delete to work you need to use the actual source path .. like so

rsync -ar --delete path/to/src path/to/destination 

You must log in to answer this question.

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