change filename based on filepath location
Hello Apple friends,
I'm trying to create a script or automator script that does the following:
“create file name (rename file) based on the folder names it has been located”
I feel the script would work within the following steps:
activate the script by pressing a shortcut while keeping the file selected
the script will look at the location path of the file
the script will remove all characters used after the ”-“ character
where there are empty spaces between the /../ there will be no action
after the first part there will always be a “-“ after
in all other cases if there a values between the /…/ these values will be separated by a “_“
the original filename would be used and put in the and separated by a “-“
the original filename should be changed in all capitals, all spaces should be replaced by “_” and all other characters besides letters and numbers should be removed (such as *#(%& etc.)
As an example the following:
example file name: boot Design.dwg
example path name:
volumes://XXX_490/-P1_DE/-A01_A99_ATTRACTIONS/P1_A01-WILDCARD/-F01_F99_FLOORPLAN S/F01-GROUNDFLOOR/boot Design.dwg
Processed by the script the filename would be changed based on the location and would look like:
XXX_490-P1_A01_F01-BOOT_DESIGN.dwg
The path would be:
volumes://XXX_490/-P1_DE/-A01_A99_ATTRACTIONS/P1_A01-WILDCARD/-F01_F99_FLOORPLAN S/F01-GROUNDFLOOR/XXX_490-P1_A01_F01-BOOT_DESIGN.dwg
OS X Yosemite (10.10)