How to Overwrite File With Tmp One?

I'm generating a file, but after generating a new one, I'd like to replace the original one, any pointers?

Trash file, then Move action work great
solved!

1 Like

Hey @hello,

You don't have to trash the file first if you don't want to.

Keyboard Maestro's Write to a File action will not overwrite an existing file for safety reasons, but it's simple to do with the shell.

** Note – I frequently prefer to trash a file before replacing it, so I have the option of retrieving it if my task went awry somewhere.

-Chris


Write to A File with Overwriting v1.00.kmmacros (5.6 KB)

Thanks, should have expanded on my post a little bit that I was using the shell, so it is:
1.- shell (create "file2")
2.- Trash "file1"
3.- Move (replace/rename) "file2" → "file1"

I'm skipping a step and overwriting File 1.

Unless you're using File 1 to create File 2 there's no necessity for the extra step – unless you need the trashed file for safety.

-Chris