How to Rename a Dynamic File Automatically Without Prompting User Input?

There is a folder X that I am using to put video file that I'm uploading to YouTube.

I would be putting various video files to folder X in such a way that at any point in time, folder X would either be empty or would have only a single video file (which, I would take care of manually).

I need Keyboard Maestro to change the name of the file (whatever video file is there at that point in time in folder X). I am calling this changed file name here as 'video title' as that is going to be the title of the video on YouTube. 'Video_title' is a KM variable that would have different text each time (which would be changed using another macro).

Sounds pretty easy but I'm still not being able to wrap my head around it. I tried understanding this post but couldn't.

Is this what you mean? Set the path in the green action to your upload folder and trigger the macro. If the folder contains a file, it will be renamed according to your global variable Video_title. It assumes there really is only one file in there at a time.

Rename Youtube Upload.kmmacros (40 KB)

Macro screenshot

I think the OP wants to use a Folder trigger.

Ahhh... In which case, @fluid_eye, can you post the macro that sets Video_title? We should be able to do all this in one go.

Regardless, here's the same macro I posted earlier with a folder trigger.

Rename Youtube Upload.kmmacros (41 KB)

Macro screenshot

Yes!

Thanks

You in fact provided more comprehensive macro taking care of other aspects (for example, number of files in the folder) than I was hoping for. Thank you.

Hey Christopher, thanks for chipping in

Macro by @noisneil is perfect. But it is a good reminder for a me that feature like 'folder trigger' exists :smile: