Last active
January 5, 2016 18:15
-
-
Save PCfromDCSnippets/e97aa014e57206f8c4b4 to your computer and use it in GitHub Desktop.
Wait 10 Seconds and Delete Old File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region wait for 10 then Delete Old Files | |
# wait for 10 | |
for ($i = 10; $i -gt 0; $i--) { | |
Write-Host("Deleting old files in $i seconds") | |
Start-Sleep -Seconds 1 | |
} | |
# delete old files | |
foreach ($item in $items) { | |
Remove-Item -Path $item.CurrentLocation -Force | |
} | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment