Deleting large amounts of files

I have found over the years that I need to delete a large amount of files at one time.  The problem with the del, rmdir, and even remove-item they all use an array then delete things, which takes memory and time.  This way you can just delete all the files in real time file by file.

[IO.Directory]::enumeratefiles(“c:\windows\temp\”,”get-cswindows*”) | %{remove-item $_}

If you want to see the files as they are being deleted you can do this, but does add overhead

[IO.Directory]::enumeratefiles(“c:\windows\temp\”,”get-cswindows*”) | %{write-host $_;remove-item $_}

4 thoughts on “Deleting large amounts of files

  1. Overnight Delivery Valtrex Order Plavix Online [url=]Buy Cialis[/url] Buy Levitra Online Canada Infections Treated By Keflex Buy Ganeric Viagra Online

  2. Canadian Pharcharmy Online Zithromax Interactions [url=]buy zoloft uk[/url] Cialis Cheapest Lowest Price Zithromax And Alcohol Interaction Priligy Approved By Fda

Leave a Reply

Your email address will not be published. Required fields are marked *