Say I haveSRC   001.jpg  002.jpg  001.txt  a.zipDEST  hello.jpgrsync -d --delete SRC:{*.jpg,*.txt} DESTIt doesn't remove hello.jpg from DEST, any idea how to archive this?
Delete extraneous files from dest dir via rsync?
rsync
The reason your command isn't working is explained by the manual page for rsync (emphasis added):--deleteThis  tells  rsync to delete extraneous files from the receiving side (ones that arent on the sending side), but  only  for the directories  that  are  being synchronized.  You must have asked rsync to send the whole directory (e.g. dir or dir/)  without using  a  wildcard  for  the directorys contents (e.g.  dir/*) since the wildcard is expanded by the shell and rsync thus   gets a  request  to  transfer individual files, not the files  parent directory.  Files that are excluded from the transfer  are   also excluded from being deleted unless you use the --delete-excluded option or mark the rules as only matching on  the  sending side                (see the include/exclude modifiers in the FILTER RULES  section).Thus, when you run$ rsync -d --delete SRC:{*.jpg,*.txt} DESTthe unwanted files in DEST are not being deleted because you haven't actually asked for a directory to be synced, but just for a handful of specific files.  To get the results you desire, try something like this:rsync -d --delete-excluded --include '*.jpg' --include '*.txt' --exclude '*' SRC/ DEST/Notice that the order of the include and exclude directives matter.  Essentially, each file is checked against the include or exclude patterns in the order that they appear.  Thus, files with .jpg or .txt extensions are synced since they match the included patterns before they match the excluded * pattern.  Everything else is excluded by the --exclude '*' pattern.  The --delete-excluded option ensures that even excluded files on the DEST side are deleted.