Shell globbing always start in the directory, eg ls *
lists contents and not the directory itself. There's almost certainly (because Unix!) an option to change that behaviour to include the .
file (current directory) but I'd worry about also targeting other hidden files like .DSStore
.
find
is similar. I guess you could start one folder above the chosen folder, but it's probably just easier to change it in a separate step if it needs doing.
For the files, I don't think they'll be renamed because I don't think they'll have XXX
in their names (and if they did I'd expect them to need to be renamed!).
But find
lets us control what gets changed, and also makes it easier to pump in variables from KM. So here's a variant using find
which is slower (unlike shell globbing it has to spawn a process for every file changed) but certainly more user friendly.
Recursive Rename using 'find'.kmmacros (10.1 KB)
On your KM-native macro:
I did a thing a couple of weeks back showing that KM did recursion -- this could be the ideal example of practical use!