Powershell method to purge cache files from a DNN installation -


I find a method to clear cache files by using PowerShell to install a DNN I am doing There are several directories with cached pages based on portal ID number. I am looking to use the regular expression for loop through each directory and to clean the files in it. Here's the example of the directory:

  D: \ MySites \ portal \ 1 \ cache \ page D: \ MySites \ portal \ 174 \ cache \ page D: \ MySites \ Portals \ 12 \ Cache \ Page  

etc.

The number between the portal and the cache will not exceed 3 digits (1 - 99).

I have a GCI recursive script but it does not work as expected. I would not like to list a list of all the directories as I have shown above, because it will be a large list. Besides, I want to redo through, which contains only one number (not _Default or other names, especially the only numbered directories) and purify the files.

  gci -r D: \ MySites \ portal \ "[0-9] [0-9]" \ cache \ page | Where-filter script | Any suggestions would be great (I'm stuck with Regex and -FilterScript right where the block is).            For many of the three, spent a lot of time in finding regex Just run three lines for each scenario:  

/ P>

GC-R "D : \ MySites \ Portals \ [0- 9] \ cache \ "page" | Remove-Item -Force-Revision-Error Correction SilentlyContinue- Confirm: $ False

gci -r "D: \ MySites \ Portals \ [0-9] [0- 9] \ cache \ page "| Remove-Item -Force-Revision-Error Correction SilentlyContinue- Confirm: $ False

gci -r "D: \ MySites \ Portals \ [0-9] [0- 9] [0- 9] \ cash \ page "| Remove-object -Force-Revision-Error Action silently compromise - Confirm: $ false


Comments