How do I delete all files from a directory tree where the filename contains special characters such as öäüß I have a problem with my backup program which means that I need to delete all files and folders in a specific directory tree where the filename contains special characters, in my case the German ones such as öäüß and their capital equivalents.

I'd be quite happy to do this using the terminal but none of the commands I have tried has matched any of the files. Can anyone suggest a command I could use which would match these files?

For example, I've tried

find -name *ü*


however none of the files are matched. Any help would be appreciated.
A somewhat dangerous solution is this, from the commandline:

find . -type f ! -regex '.*/[ -.0-~]*' -exec rm {} +


Replace the lone . with the name of the top directory if you haven't changed to the relevant directory first. To be safe, however try first the shorter command

find . -type f ! -regex '.*/[ -.0-~]*'


and ensure that it only lists files you wish to delete. The regular expression (regexp, or regex) here will match any pathname that ends in a slash followed by any combination of printable ASCII characters excluding /, the space characters being the first such and ~ the last, while . and 0 surround / in the ASCII sequence.

One caveat among many: I don't know for sure if your current locale might change the collating sequence of characters, and hence perhaps change the meaning of the regexp. I don't think it does, but if it does, running the commands as

LC_COLLATE=C find …


should remove the danger.

Yet another caveat: Please ensure you have a backup before you try this. I will not take the blame for any loss of data if you get it wrong. The commandline is a great tool for shooting yourself in the foot! Sometimes just a misplaced space can spell disaster. (In this case, for example, missing the single space after the left bracket is deadly.)