This is very useful code, but I need to know how to limit the output to folders. I see there is a -Directory setting, but I'm unable to get it to work.
Below is a sample of my code. Any help would be greatly appreciated.
$FileFirst4Char=$file._Name.substring(0,4)
$FolderSearchStr=$dxfNetworkFolder + $FileFirst4Char+"*"
if (($namefromdir=(get-item "$FolderSearchStr").fullname) | select-object -First 1) {
$dxfNetworkFolder=$namefromdir
}
else {
$dxfNetworkFolder=$dxfNetworkFolder + "MISCELLANEOUS - DRAWINGS"
}