Created
January 16, 2023 00:12
-
-
Save rosshiga/8ea75520714479a8ff6055484fb44164 to your computer and use it in GitHub Desktop.
Remove Ms Office Temporary Owner Files ~$
This file contains hidden or 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
| $SourceDir = "C:\" | |
| foreach ($file in Get-ChildItem -Force $SourceDir -Recurse) | |
| { | |
| if ((($file.Extension -match ".doc") -or ($file.Extension -match ".xls"))-and ($file.Name -like "~$*")) | |
| { | |
| Remove-Item $file.FullName -Force | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment