[SOLVED] Unknown shorthand flag: 'â' in --exclude

I’m trying to to run a restic backup on some music files on my Debian Server. The command I’m using is:

restic -r “/backups/restic-repo” --verbose backup “/NAS/” -–exclude=“/NAS/Media/MUSIC” –-exclude=“/NAS/Media/GAMES”

It always spits out the same error, “unknown shorthand flag: ‘â’ in -–exclude=/NAS/Media/MUSIC/”

As you can see, that character is nowhere to be found in the command. I checked, the apt-get version of restic was very outdated, so I self-updated to the current version, restarted my server, and I’m still getting the same error.

What might be the cause?

The first hyphen looking thing in –-exclude=“/NAS/Media/GAMES” isn’t a hyphen.


Thank you! It looks like when I copied the command out of LibreOffice Writer it tried to modify the hyphens for some reason.

Now when I try to execute the command it tells me that the directory /NAS/ doesn’t exist. I suppose that is because it’s a symlink. However, when I follow the exact address to the actual mount location of the drive in question, “/srv/dev-disk-by-uuid-84475483-4c80-4f1d-a765-e6918b958631/”, found using the df command, it still says it doesn’t exist…

Any ideas?

  • List item

Please provide an exact copy of the command you ran and the complete output you get.


restic -r “/backups/restic-repo” --verbose backup “/NAS/” --exclude=“/NAS/Media/MUSIC/” --exclude=“/NAS/Media/GAMES/”


“/NAS/” does not exist, skipping
Fatal: all target directories/files do not exist

While in root, input: find . -maxdepth 1 -type l -ls
which output: 3373 0 lrwxrwxrwx 1 root root 59 Jul 2 2022 ./NAS -> /srv/dev-disk-by-uuid-84475483-4c80-4f1d-a765-e6918b958631/

directly pointing that my /NAS/ folder is a symlink to: /srv/dev-disk-by-uuid-84475483-4c80-4f1d-a765-e6918b958631/

When I re-do the entire restic command substituting the real mount location of that drive (/NAS/ is just a direct symlink to the root of the drive in question,):

restic -r “/backups/restic-repo” --verbose backup “/srv/dev-disk-by-uuid-84475483-4c80-4f1d-a765-e6918b958631/” --exclude=“/srv/dev-disk-by-uuid-84475483-4c80-4f1d-a765-e6918b958631/Media/MUSIC” --exclude=“/srv/dev-disk-by-uuid-84475483-4c80-4f1d-a765-e6918b958631/Media/GAMES”

The output is the same thing basically:

“/srv/dev-disk-by-uuid-84475483-4c80-4f1d-a765-e6918b958631 does not exist, skip                                                                             ping
Fatal: all target directories/files do not exist
-bash: ”: command not found

This is again probably because of your use of non-plain-ASCII characters. I’m guessing you copied the “/NAS/” part from LibreOffice? That would explain the fact that your quotation characters there are not regular ASCII ones (" vs your and ). Unless I’m mistaken (I haven’t tried this), your shell tries to find a path with those funky characters in them, and this of course does not exist.

If you ditch your use of overformatted text I think you’ll have more luck. Try using a plain text editor instead of a rich text editor for things like this, or make sure that it doesn’t replace “plain/basic” characters with funky ones.

All in all, rewrite the entire command from scratch, by hand and using plain/basic (ASCII) characters, instead of copy-pasting it from LibreOffice or similar, and see how that goes :slight_smile:

This too clearly shows that the shell doesn’t like your formatted text.

1 Like

That was it, thank you!

My actual process was, when I realized that libreoffice was messing with my text, I would first copy it into regular Windows Notepad, where I replaced all the hyphens. I did not realize that the quotes that look curled in fancy text editors are literally different characters, I assumed they were just a different visualization of the same character, so I didn’t change them initially.

Changing them in notepad to regular quotes fixed the issue!

1 Like