As a linux administrator, there may be a situation where you may want to replace special characters from a file or directory name.
You can easily rename such file or folder by command "mv <old file name> <new file name>". But what if you want to replace special characters of all files and folders present inside a directory. And also it should replace special characters recursively.
You can use following script to replace special characters. In following script, we have replaced special characters by "_" character.
1) Following script will check for special characters in all files and directories present under /mailstore.
2) If you want to replace special characters from another directory then modify script by providing path name of new directory instead of /mailstore.