At work I use OneDrive for Business and regularly get files that I need to save in the cloud. Some of these files contain characters that OneDrive for Business does not like thus they don't get synced. My thought was that I could use Hazel to monitor the entire folder for OneDrive for Business to watch for any files that contain these illegal characters. My first thought is to try writing a shell script that reads in the name when captured and renames the file with substituted legal characters within that folder. So there are two questions that stand out...
1. Is there a method to do this without writing a script?
2. If I write a script, I noticed that $1 is used to read the filename but how do I read the path where the file is contained.
I'm not exactly super fluent in writing scripts but I can usually get the job done so option 1 would be nice. If I go with option 2 of writing a script, I'm not familiar with how Hazel interacts with said script to pass that information. Would the path be part of the filename(i.e..../Users/DTrump/OneDrive - WhiteHouse/Twitter Password!.pdf)
The illegal characters that aren't allowed in OneDrive for Business are \ / : * ? " < > !
Thanks for any help one can offer.