Copy List of Filenames and use to Rename other Files

EDIT: This post was originally here: Paste In Order Copied

I know I sound like an idiot, but I can't figure out how to use this. What I am trying to do is copy these file names:
image
And then, paste their names in the order I copied them onto these files:

I feel like I am close. The Clipboard History tool in KM helps out a ton, but I have the feeling there has to be an easier way to just keep pasting. From reading your documentation, it seems that if I long press command-V it will act as modifier for pasting from KM Clipboard. That seems genius and exactly the kind of behavior that would work for me.

I am probably just being a noob, but really struggling here and would appreciate any insight. Not opposed to learning so I don't have to rely on you all. KM is so deep and uses lingo (I assume coding) I am not super familiar with.

/end rant lol :joy:

Here is a video that shows what I am wanting to do. It seems like videos showing my process that I am trying to do might be helpful from using this awesome forum. Thanks!

1 Like

Hello Josh (@Millsj1134),

Even though I don’t have much time currently, I decided to watch this YouTube video you’ve made - just to verify that I understand your issue with This Macro - which was written by JMichaelTX (he sadly passed away) in purpose to create a Copy‘n‘Paste Queue of as many junks of text you like and then paste them in a specified order all together one after another in in one go.

Since you like to use the general Purpose and functions of this Macro to Batch Rename Files in the Finder - which could be done - you will have to rebuild this Macro by using one of the many possible ways - so that it would work like you want it to work in the Finder.

Otherwise you will have no luck to use the functionality this macro provides.

Greetings from Germany :de:

Tobias

I think what @Nr.5-need_input said is accurate: this particular macro is not really suitable for what you’re trying to do. In other words - to get to where you’re going I wouldn’t start from here :wink:

To jump the gun a bit here I think you’re trying to do this: rename a bunch of files in a folder using a list consisting of file names obtained from another folder. (Good video BTW.)

If that is correct then how about taking a look at these:

and

Both of these approaches will require some modification to exactly suit your needs.

I’m a bit pressed for time right now but I may be able to help later if you (a) can confirm this is generally an accurate description of what you’re trying to do and (b) lack the confidence to progress this further on your own.

In any case, you might want to create a new separate post as I’d say this is a new problem that you’re asking for advice about. That way more KM users would get to see it and one of them might have already built a macro to do it!

3 Likes

Looking at your actual task I think there might be another way to do this.

First in Finder multiple-select all the files you want to use as the new names. Press ⌘C to copy all the names at once to a list in the System Clipboard.

Then multiple-select all the files that you want to rename and run the Macro (hotkey is ⌃⌘V at the moment).

This will overwrite the selected files' names with the copied filenames.

This does depend on both sets of files being in the correct order and there is no undo so, try it out on some test files first! I also added a Prompt Action that pops up for each file. If the preview of the renaming is not correct you can press Cancel to exit the Macro at any point.

EXAMPLE Paste Multiple Copied File Names-Animated GIFF 640 12fps

EXAMPLE Paste Multiple Copied File Names.kmmacros (20.5 KB)

Click to Show Image of Macro

EDIT - as @tiffle was suggesting that this could be started as a new post, I have split it off here, into its own question.

3 Likes

Thanks for taking the time to answer this. Sad to hear about JMichaelTX. I appreciate your advice and info.

2 Likes

Thank you SO much for taking the time to answer and your willingness to help! I am just now seeing this an it seems that @Zabobon might already have a solution. I hope I haven't wasted any of your time. If you already have a macro built then I wouldn't be opposed to testing it out and seeing how it works.
Thanks! (And thanks for the compliment - the video is made with OBS.) :blush:

1 Like

Thank you SOOO much! I will try this out ASAP and see how this works! I can't wait! :blush: You're awesome!

1 Like

@Zabobon I have tried it and it works perfectly! This is unrelated, but I have found that I can't trigger it with either the hotkey you made (control-commands-v) or via my Stream Deck. I wonder if I need to add some kind of time delay or make KM be "in focus" as the first step in the macro. I have noticed I sometimes need this in other macros I've built. Have you ever run into this?

PS: I have a two screen set up... maybe that's causing the issue? :thinking:

Sorry for bombarding you with questions! :joy: Thanks again!

Yup - @Zabobon:sunglasses: has got you covered.

My macro is more or less the same when it comes to renaming the files except it doesn't ask you to verify. What is different is that it starts by prompting you for the folder that is the source of the new file names and then for the folder containing the files that are the target for renaming. As a consequence you don't really need to have any Finder windows open. Anyway, for what it's worth, here it is:

Download Macro(s): Rename Files Using a List.kmmacros (8.9 KB)

Macro-Image

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 10.15.7
  • Keyboard Maestro v10.2

Given this macro renames files it might inadvertently do the wrong thing if, for example, the number of files in the source and target folders are different, or there isn't a one-to-one correspondence between the file names. So it's always advisable to try the macro out first on a set of test files/folders.

2 Likes

Wow, this one works awesome too! Thanks @tiffle! :blush: If I can ask the same questions I did before to @Zabobon: I cannot trigger the macro using the hotkey or via my StreamDeck. Have you ever had this happen? I would love to be able to do this if possible.

1 Like

@Zabobon @tiffle the issue is - I think - that I did not have the Macro Parent group enabled :man_facepalming:

Sorry! And thanks again!!

1 Like

That would indeed prevent triggering.

2 Likes

:joy::joy::joy: my bad

Hello, I realise this is over a year ago, but in case anyone still uses this function (copying various files to the clipboard and then using the example macro posted by Zabobon to paste multiple copied filenames) does anyone know any reasons in which this wouldn't work? It was fantastic to find this, as the scenario described by Millsj1134 and the solution by Zabodon (shown with Zabodon's GIF solution) is exactly what I'm trying to achieve, though it's just not working for me unfortunately. I had thought that it 's simply because I'm on quite an old system (mid-2012 MacBook Pro temporarily running Yosemite until I've finished exporting things from legacy software) but it does seem to be that Keyboard Maestro is getting somewhere - just not executing it as desired. I have the Macro enabled, copy the desired filenames, and use my desired hot key to run Zabodon's macro, but when I use that hot key on the same amount of files (i.e. the corresponding files [same amount] on a mounted destination drive still with their old filenames), the Macro pastes the second source filename onto the first destination file (not sure why it's deciding to start from the second source filename, ignoring the first one I want to paste - I've done the usual selection from first file to last file, and the files are displayed in the same order in the destination area) and then the rest of the pasting for the remaining files doesn't work at all, with an error message from KM telling me that the "“action failed because destination is not a full path” (despite the fact that the first paste occurred, albeit incorrectly). If anyone has any ideas please that would be really appreciated - unless this is all beyond my little old Mac (but I'm really hoping that instead, it's because I'm not used to KM and missing something obvious).