/
Run the DeleteFiles Powershell Script

Run the DeleteFiles Powershell Script

5.8.0+

Overview

The DeleteFiles Powershell script is a utility script which lives in the Astun\Tools\Powershell directory which can be used through a Workflow Task to clear out directories that can fill up with temporary files over time. This script may also be run from the Command Line.


From the Command Line

.\DeleteFiles -path pathToDirectory -filespec fileTypeToDelete [-age ageToDelete] [-recurse searchChildDirectories] [-ignore listOfFilesToIgnore] [-commit performDeletions]

From Workflow

Create a Program Workflow Task 

Name

Enter a unique name for your task. It is advisable to call this something relevant as this name will be used to populate list box selections when creating Jobs e.g. Delete Temporary SLD Files.

Program

Use the browse button to select the powershell.exe program from the Windows folder e.g. c:\windows\syswow64\windowspowershell\v1.0\powershell.exe

Additional Parameters

Here you need to enter the following details:

-ExecutionPolicy Bypass d:\astun\Tools\Powershell\DeleteFiles.ps1 -path d:\astun\isharemap\webservice\sld\ -filespec *.xml -age 1 -commit $true

E.g.

DeleteFile Parameters

Parameter
DescriptionExample
-pathMandatoryThe fully qualified path to the directory that you want to clear.-path d:\astun\isharemap\webservice\sld\

-filespec

MandatoryThe wildcard specifying the type of file you want deleted.-filespec *.xml
-ageDefaults to 24Delete files over this many hours old, 0 will delete all files.-age 1
-recurseDefaults to $falseAlso delete files from all child directories.-recurse $true
-ignoreDefaults to ""Comma-separated list of files to ignore.-ignore "test.xml,donotdelete.xml"
-commitDefaults to $falseOnly deletes any files if this is set to $true, which is useful for testing.-commit $true

Related content

Use HTML in Attributes
Use HTML in Attributes
Read with this
Run a Powershell Script using Studio Workflow
Run a Powershell Script using Studio Workflow
More like this
System Connections
System Connections
Read with this
Remove SLD files over a certain size
Remove SLD files over a certain size
More like this
Remove MapServer / PostgreSQL & iShare temporary files with Studio Workflow
Remove MapServer / PostgreSQL & iShare temporary files with Studio Workflow
More like this
Find which schemas/tables are taking up excessive disk space
Find which schemas/tables are taking up excessive disk space
More like this