marcello said:
:Hi my name is marcello,
:
:I have this problem,
:my application call a Runtime.exec() where the command is:
:
:On Linux
:
:"rm -f -r /usr/local/wa/etichette/etichetta0"
:
:On Windows :-(
:
:"del c:\\Programmi\\wa\\etichette\\etichetta0"
:
:On linux is ok but in windows catch an exception
:"can'Create a process"
:
:Thank you for your help
Interestingly enough, those two commands don't necessarily do the same
thing, even if your Windows version worked.
To fix that, you probably need to put "cmd /c" in front of the "del"
command since you want the command shell to execute the del command.
But the del command deletes a file. If that's a directory, it will
error. The Linux command rm when used with the -r switch will
recursively remove a directory and its contents. The -f switch
suppresses any errors or warnings (and could be combined to "rm -rf").
If in fact the item you're attempting to delete is a file and not a
directory, why not simply do it internally in Java? Create a
java.io.File object representing it and call its delete() method.
= Steve =