RNJarvis
8/15/2016 - 6:59 PM

Folder Cleanup

Folder Cleanup

Scheduled to run daily is the task to delete any TIF files older than 10 days.

Script example: (all scripts run with the dwpkof service acct).

$kidd3 = "e:\Kofax\KCXMLImport\Input\kidd3"
get-childitem $kidd3 |where-object {$_.psiscontainer -and $_.lastwritetime -le (get-date).adddays(-10)}| foreach-object {remove-item $kidd3\$_ -recurse -force -confirm:$false}

$kidd4 = "e:\Kofax\KCXMLImport\Input\kidd4"
get-childitem $kidd4 |where-object {$_.psiscontainer -and $_.lastwritetime -le (get-date).adddays(-10)}| foreach-object {remove-item $kidd4\$_ -recurse -force -confirm:$false}

$kidd5 = "e:\Kofax\KCXMLImport\Input\kidd5"
get-childitem $kidd5 |where-object {$_.psiscontainer -and $_.lastwritetime -le (get-date).adddays(-10)}| foreach-object {remove-item $kidd5\$_ -recurse -force -confirm:$false}

$imagestore = "e:\ibml\imagestore"
get-childitem $imagestore | where-object {$_.psiscontainer -and $_.lastwritetime -le (get-date).adddays(-10)}| foreach-object {remove-item $imagestore\$_ -recurse -force -confirm:$false}

Scheduled to run on a weekly basis is the task to delete log files older than 3 months, or 6 months in the case of kofax\logs.

Example:

$path4 = "E:\Kofax\KCXMLImport\Error"
get-childitem $path4 |where-object {$_.psiscontainer -and $_.lastwritetime -le (get-date).addmonths(-3)}| foreach-object {remove-item $path4\$_ -recurse -force -confirm:$false}

$path1 = "E:\Kofax\KCXMLImport\Input\XML_Backups"
get-childitem $path1 |where-object {$_.psiscontainer -and $_.lastwritetime -le (get-date).addmonths(-3)}| foreach-object {remove-item $path1\$_ -recurse -force -confirm:$false}

$path2 = "E:\IBML\ScanLogs"
get-childitem $path2 |where-object {$_.lastwritetime -le (get-date).addmonths(-3)}| foreach-object {remove-item $path2\$_ -recurse -force -confirm:$false}

Folders affected are:

\kofax\logs\                                                                        6 months (logs)
\kofax\images                                                                  10 days (tifs)
\kofax\kcxmlimport\input\scannerid                     10 days (tifs)
\kofax\kcxmlimport\input\xml_backups              3 months (xml’s)
\kofax\kcxmlimport\error                                           3 months (xml’s)
\kofax\imagestore\                                                        10 days (tifs)
\kofax\ibml-kodak\scannerlogs                                3 months (logs)

Running on servers KIDLIC0001, KIDKDS0001, TELLIC0001 and TELKDS0001