Good mood to you all. I am writing a macro in a mace, I use Imacros and have encountered such a problem. I can not build a script to delete files.

I tried to bungle this, but it does not work.

var path = "H:\\test.js"; var file = Components.Constructor("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath")(path); if (file.exists() && file.isDirectory()) file.remove(true); 

Tell the code to simply delete the specified file.

    1 answer 1

     file.isDirectory() 

    ! missed

     var path = "C:\\test.js"; 

    And for this you need admin rights.

    • This code was not written by me. I already found it on the Internet. I just can not find how to do the removal. We need to do this but only without activeX - Anatoly