Remove the recursion and just search in the main folder:
Get-ChildItem –Path "D:\ABC\Project\*.txt" | Where-Object{$_.CreationTime –lt (Get-Date).AddDays(-15)} | Remove-Item
1
solved Powershell script to delete 15 days old .txt files [duplicate]
Remove the recursion and just search in the main folder:
Get-ChildItem –Path "D:\ABC\Project\*.txt" | Where-Object{$_.CreationTime –lt (Get-Date).AddDays(-15)} | Remove-Item
1
solved Powershell script to delete 15 days old .txt files [duplicate]