under windows-ntfs if you special characters in a filename… you can get into trouble deleting them (from command prompt it should always work)

under linux-ext3 you can run into similar problems if a filename (for whatever reason) contains “–” (two minuses)

to remove them go:

# under linux it is possible to have some very special file names like:
# create file with special chars in filename
touch -- ?[?1049lVim:
rm -rf "?[?1049lVim:"; # will not work
rm -rf '?[?1049lVim:'; # will not work
# works
rm -- ?[?1049lVim:
rm: remove regular empty file ‘\033[?1049lVim:’? y

# create file with special chars in filename
touch -- --testings.html
# another example
rm -- --testings.html

The — option tells rm to treat all further arguments as file names, not as options, even if they start with -.

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!