Hi everyone,
I would like to be able to select multiple files on Path Finder and apply certain KM actions (eg, append today's date to the beginning of those filenames) in batch.
Does anyone please know if this is possible?
Thanks,
Bruno
Hi everyone,
I would like to be able to select multiple files on Path Finder and apply certain KM actions (eg, append today's date to the beginning of those filenames) in batch.
Does anyone please know if this is possible?
Thanks,
Bruno
Hi,
If your search on the forum, you will find a bunch of topics about renaming files in Path Finder.
Anyway, try this macro:
Append Today's Date to the Beginning of the Filenames.kmmacros (28.5 KB)
It will add "CurrentDate_" ("31012019_" in this case) to the beginning of the files. Take a look at the following link to read more about ICU Date/Time Tokens and how to format date and time:
https://wiki.keyboardmaestro.com/token/ICUDateTime
The macro uses an AppleScript to get the files from Path Finder:
tell application "Path Finder"
set selItemList to selection
if selItemList ≠ missing value then
repeat with i in selItemList
set contents of i to (get POSIX path of (contents of i))
end repeat
else
return 0
end if
end tell
set AppleScript's text item delimiters to linefeed
return selItemList as text
Then it uses a For Each Action to loop over the files and rename them:
Hope this helps!
A tip for working with paths.
KM now has a Split Path action, which is great when working with paths.
PS. I have prepended the names with "Local__" so the variable is deleted again when the macro has run.
You are absolutely right. I modified a really old macro and forgot about the Split Path Action. Thanks for mentioning it!