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

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top