Summary
In this chapter, you learned how to efficiently scan files and folders on a system. You started by exploring how to list folders, subfolders, and files by using the Get-ChildItem
cmdlet. You then learned how to narrow your search by including only certain file extensions through using the -Include
parameter. You proceeded to scan the contents of files by leveraging the select-string
cmdlet. You then explored how to handle long file paths and access denied messages. You continued by learning how to narrow your search results by excluding specific files. Finally, you created a function to scan directories, including specific extensions, excluding specific files, and handling long file path and access denied errors.
In the next chapter, you will learn different scripting techniques to optimize your script execution speed.