Question

Can somebody tell me the best way to delete a series of files between April 1, 2014 and April 17, 2014 on Windows server 2003 command line

Was it helpful?

Solution

This PowerShell oneliner will do the trick. You can remove the back-ticks and put the code all on one line if you want.

Get-ChildItem C:\data\*.* | `
Where-Object {$_.lastwritetime -gt '4/1/14' -AND $_.lastwritetime -lt '4/17/14'} | `
Remove-Item

I found a shorter version of the script here. I prefer to use the full Powershell cmdlet names though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top