Sorry but I checked all the other post similar to this, but could not find the working solution.
error:- Get-ChildItem : A parameter cannot be found that matches parameter name 'File'.
I want to delete files older than 30 days from folder and sub folder. Script running fine locally but throwing error while running on server. powershell version is 5. Any help is appreciated! script:-
Get-ChildItem –Path "D:\file\source" –Include *.* -File -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item