PowerTip: Use PowerShell to Find Files in Wrong Folder

Doctor Scripto

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


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

PS C:\> 


Discussion is closed.

Feedback usabilla icon