I need a Macro that allows me to select, in the Finder, 1 file/folder up to a larger number of files and folders that I can then run a Macro on that removes characters in it’s name, ones that aren’t acceptable with OneDrive.
These are the characters: ~ " # % & * : < > ? / \ { | } .
Also, no Leading and trailing spaces are allowed in file or folder names.
My method for creating Macros is self-described as a “point and click approach”.
Works great 90% of the time, but not this time (I pulled that number out of nowhere).
So, with “Hat in Hand”, any assistance would be greatly appreciated. Thank You.
Hi @ChilliDog32 - you might want to give this macro a try. It assumes you've selected 1 or more files in Finder before running it. Then it renames each of those selected files with a cleaned up version of the name.
Note: for testing purposes, the macro currently just displays how it's going to rename the files rather than actually doing the renaming. You should use this facility to test on some of the files you have in mind.
When you're happy that it works as you require, just disable the Display action (in green) and enable the Move or Rename action (in red) and you should be good to go.
This is Great! I have an additional question, if you don’t mind… is there a way to include the removal of any spaces before the period preceding the file extension?
I would like the macro to have the ability to delete all the spaces; currently it only deletes one (example: if there are 4 spaces before the period, using the macro deletes one, leaving 3 spaces).
I really appreciate your time and knowledge with this one!
A little late to the party, but I like to point out that my Find Any File app provides a search macro for finding files whose names are not allowed on OneDrive, see Thomas Tempelmann - Find Any File - Scripting
With that, you can get a window that lists all those files, and then a KM macro could be used to rename them. With FAF in the middle, you can see the relevant files before renaming them.
Not sure if KM macro can be applied to items shown in FAF, but I'd be interested in finding out once I am back at a computer.