Search code examples
unixquotesrm

Deleting strange directories in unix


I am having some issues deleting some folders in unix.

Directory 1:

?0\'

Directory 2:

-1\'

I would like to delete them recursively so something like

rm -rf -1\'

Not sure on how to escape the quotes, dashes and question marks.


Solution

  • You need to use quotes when they are fishy characters, then use a wildcard outside of the quotes. Without quotes those characters would want to preform other tasks.

    rm -rf -- *"\'"
    

    Thanks to a comment by osgx