I need to generate a configuration file for our Pro/Engineer CAD system. I need a recursive list of the folders from a particular drive on our server. However I need to EXCL
Based on @NN_ comment on @Guillem answer, I came up with the below code. This allows you to exclude folders and files:
Get-ChildItem -Exclude 'folder-to-exclude','second-folder-exclude' |
foreach {
Get-ChildItem -Path $_ -Exclude 'files-to-exclude','*.zip','*.mdmp','*.out*','*.log' -Recurse |
Select-String -Pattern 'string-to-look-for' -List
}