Move a File to a Folder and Replace Same-Named File

(@gglick and @Tom, i forgot to tag you on the above, just wanted to make sure you get to see my additional question. thanks! -todd)

To keep the old file with the same name instead of trashing it, you need to modify the Split File action to save the file's base name (i.e. the name without the extension) and the extension into separate variables, to use them when renaming the existing file. There are, of course, any number of ways you could go about the renaming part, but I chose to use the ICU Date/Time token including milliseconds as a suffix coming after the original file's base name, so that you can move multiple files at once without any of them conflicting. The syntax used to rename a file to that looks like this:


and the result looks like this:


Here's the modified macro, with the actions that differ from the last version marked in yellow:

Move to Links Desktop Folder Without Replacing - from gabe glick.kmmacros (5.6 KB)



Omg this is great, and appending the files with the date+time is so smart... THANK YOU!

(I tried to do this macro myself before posting but after you explained what you did I see I never would have even had a chance lol)...

A question:

I didn't realize until testing, but is there a way to have this work on either a file OR a folder?

Or am I now getting too greedy lol.

With gratitude, -todd

You're welcome. Glad it's working well for you. I had to add another if/then action to the macro, but yes, there's a way to have this work on folders as well as files:

Move to Links Desktop Folder Without Replacing 1.1.kmmacros (6.8 KB) 1.1.kmmacros


@gglick this is great! i was trying to figure out how to do this but didn't know where to even begin lol. thank you very much, i love it!! -todd

1 Like