Remove SLD files over a certain size

Overview

We have had a couple of instances where large SLD files are created by iShare and, as a result, the D drive can run short of space. This in turn can cause problems loading the iShare application. We have provided a script that can be used to delete all SLD files over a certain size. This can then be added to a Workflow Task, which you can then choose to run automatically via a Workflow Job, at the best time to suit your business.

It is worth noting that iShare logs and temporary files are already managed via various methods (e.g. rolling files or scheduled workflow) but this script can be adapted to suit your needs where you may want to delete files once they reach a certain size. Please contact Astun via the Support Portal if you would like assistance with modifying this script.

Step-by-step guide

  1. Copy the following to a text editor such as Notepad++

    @ECHO OFF set /A FileSize=38000 set Filter=sld-*.xml set Folder=D:\Astun\iShareGIS\LIVE\WebApps\WebService\sld FOR /R "%Folder%" %%F IN (%Filter%) DO ( IF %%~zF GTR %FileSize% ( ECHO Deleting "%%F" DEL /F "%%F")) EXIT
  2. Edit the “Folder= “ to point to the location of the SLD files that you wish to delete.

  3. You can also change the default FileSize of 38000 and change the Filter if you wish to use this to delete other large files.

  4. Save it to location on the iShare Server e.g. E:\iShareData\Utilities with a .bat extension e.g. delete_files_over_certain_size.bat.

  5. Create a Workflow Program Task to run the .bat file e.g.

  6. In this example we have actually created a Workflow Job called “Live - Schedule Maintenance” and created our Task under this Job. This means that the Job can then be scheduled to run automatically.
    Alternatively if you just wanted to run the Task manually you could just create the Task under the Unassigned Tasks Job.