PowerShell – Remove all files from a folder

This script will delte everyting in the “Script” folder, sub-folder, and the “-recurse” option will prevent the prompting of confirmation. The “-exclude” option alllows you to exclude files and folders.

Alternative;

More on the Remove-Item Powershell cmdlet can be found here:

Powershell 1.0
http://technet.microsoft.com/en-us/library/ee176938.aspx

Powershell 4.0
http://technet.microsoft.com/en-us/library/hh849765.aspx

JohnyLuky has written 54 articles

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">