Re[2]: Flowscript - delete file

2012-12-27 Thread Martin Heiden
Hi Peter, Ok, I missed something: var xml_file = Packages.java.io.File("D:\cocoon-2.1.11-wl\build\webapp\B&B\xml" + file + ".xml"); should be: var xml_file = new Packages.java.io.File("D:\cocoon-2.1.11-wl\build\webapp\B&B\xml" + file + ".xml"); But you should try the function Robby sent

Re: Flowscript - delete file

2012-12-27 Thread Peter Sparkes
Hi Martin Thanks for your suggestion, unfortunately I get the same error. The error log gives: ERROR (2012-12-27) 15:30.46:723 [flow] (/office/deletefile_) PoolThread-4/JSErrorReporter: "file:///D:/cocoon-2.1.11-wl/build/webapp/office/flow/deletefile.js", line 13: missing name after . op

RE: Flowscript - delete file

2012-12-27 Thread Robby Pelssers
importClass(Packages.java.io.File); importClass(Packages.java.io.FileNotFoundException); function deleteFile() { var filePath = cocoon.parameters["file"]; var file = new File(filePath); try { if (!file.exists()) { throw new FileNotFoundException(filePath); }

Re: Flowscript - delete file

2012-12-27 Thread Martin Heiden
Hi Peter, PS> //Delete file PS> Packages.java.io.File.xml_file.delete(); Try xml_file.delete(); You just have to add the full "path" to the class when you construct it. After this, the variable contains a reference and you can just use it. Regards, Martin. Thursd

Flowscript - delete file

2012-12-27 Thread Peter Sparkes
Hi, I am trying to delete xml files using the following flowscript: function deletefile() { //file to be deleted var file = Packages.java.lang.String(cocoon.parameters["file"]); try { // creating a link to the file to be deleted var xml_file =