Using open() in processing 2

I know launch is the new open in 3.0+
but I use open to run .exe 's and everything works fine.

I want to rename a file using open and the cmd .exe
i tried:

open(“rename c:\path\file.fil file.bak”)

and nothing happens , no error but .bak fil is not created
same line at command prompt works fine , so syntax is correct.

Also tryed putting cmd.exe before rename , same result.

Should be able to invoke command sthe same as command line right?
Am I missing something in the syntax for open to work?

Thanks

1 Like

I thought that launch and exec were both present in both 2.0 and 3.0 – and only launch was listed on the reference, but both are in the API.

I’m not as familiar with the Windows command line – I can only test on Linux / Mac, so I can’t answer your question.

You might want to try exec, which is mentioned in the launch reference and described in the API linked from the top of each reference page.

Thanks for your reply.
I tryed exec and launch and both give not recognized error
i’m using 2.2.1

Will do it again in smaller context test sketch to make sure.
thanks
Jeff

Apologies if I was wrong about exec() – I don’t have Processing 2.2.1 on this machine for a quick check. Could download and check the reference folder for the API files.

If the object to be renamed is static, a workaround might be to open a script (e.g. a bat file) referenced by static name, and put your rename command and argument in that file. Use open on the bat. Untested as I am not on Windows.

Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html#renameTo(java.io.File)