Whenever I download .docx and .ppt files from my school, they always look like this.
UTF-8"File%20Name%20Example.docx
It's pretty annoying to have to rename the file every time I download one, so I want to create a bash script that will do the work for me.
I have a School folder, so I'd like to do a bash script that searches the entire directory and subdirectories for any files that start with the "UTF-8"" prefix, then.
- Have a for loop that removes the prefix from all files starting with that prefix
- Search the filename for occurences of "%20" and replace it with " "
- Monitor the School folder so that any time I download another file with the prefix, it will run the script and immediately rename it.
I am pretty new to linux. I have been researching for the last two hours and I am confused on what I should do. Any help would be greatly appreciated. Thanks!
inotifywait
andrename
like described here How can i change the default name for the screenshots made by gnome-screenshot?. A suitable regular expression for therename
portion might be's/^UTF-8"//;s/%20/ /g'
. – steeldriver Jun 26 '20 at 21:39