PowerTip: Use PowerShell to Find Files in Wrong Folder


Summary: Use Windows PowerShell to easily find files that are in the wrong folder.

Hey, Scripting Guy! Question I have a folder for documents and another folder for images. But at times, I discover images in the
           documents folder. How can I use Windows PowerShell to easily detect this situation?

Hey, Scripting Guy! Answer Use the Test-Path cmdlet, and specify the file extension to exclude, for example:

PS C:\> test-path c:\fso -Exclude *.bmp

True

PS C:\> dir c:\fso -Include *.bmp

PS C:\> 

Comments (0)

Skip to main content