Unblock and Delete files that have been locked by Java

There is an issue with java locking files that are in use. Mainly when using the webserver.
Causing it to be impossible to delete them while the gateway is running.

But here is a solution! (For windows atleast). Using handle you can find and unlock files.

I made it a bit easier to use by writing a simple bat file.
UnlockAndDelete.zip (891.3 KB)

Unzip on the pc in the gateway (in for example C:\Folder)

You can execute this through script or in the cmd line, requires admin rights!


system.util.execute(["cmd.exe","/C", "C:\\Folder\\UnlockAndDelete\\unlockAndDelete.bat","C:\\Program Files\\Inductive Automation\\Ignition\\webserver\\webapps\\main\\test1.jpg"])


"C:\Folder\UnlockAndDelete\unlockAndDelete.bat" "C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main\test1.jpg"