I am executing the following command (to find all files with .ts extension and deleting them):

find . -type f -name "*.ts" –delete

An error shows up:

find: paths must precede expression: `–delete'

What have I done wrong?


1 Answer 1


You have typographic sign instead of minus (-).

Change your command to

find . -type f -name "*.ts" -delete

For complete syntax see man find:


        Delete files; true if removal succeeded. If the removal failed, an error message is issued.
        If -delete fails, find's exit status will be nonzero (when it eventually exits).
        Use of -delete automatically turns on the -depth option.

Be careful with copying and pasting commands from blogs and rich text processors. They may transform some typographic symbols to their plain text equivalents and vice versa.

Consider to use simple text editors for the notes next time - use plain text, Markdown or reStructuredText.

And as @AuxTaco mentioned - some blogs may rely on your copying to attack your computer.

  • 9
  • In this particular case we do not know the source of this command. If original author wrongly had -- then engine converted it to . So we do not know the whole story :)
    – N0rbert
    Commented Jan 2, 2019 at 11:04
  • 2
    I can tell the story: I copy-pasted it from terminal to a MS Word document consisted of command set to deploy our server. MS Word is auto-fixing the dash in some cases. Then a year or some after i copied that command and the question opened... Thanks.
    – Dorad
    Commented Jan 2, 2019 at 14:48
  • 1
    It's probably better to use Notepad++ in this situation, rather than Word.
    – Davidw
    Commented Jan 2, 2019 at 22:41
  • 1
    Never use a word processor to edit code. That's (a big reason) why there are still text editors. The last thing you need is substituted characters, or word wrap.
    – Joe
    Commented Jan 3, 2019 at 12:34

You must log in to answer this question.

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