Hi, I'm trying to pull a list of all the directories and sub directories on a file share down to 3 levels. It works well but the only issue is it includes files as well but I can't figure how to exclude them, this is my script that works great bar the file issue.
$files = @()
$files = Dir X:\Animals
$files += Dir X:\Animals\*\
$files += Dir X:\Animals\*\*\
$files | sort FullName | Select -Unique -Property FullName | Export-CSV -NoTYpe X:\ANIMALS\TestReport.csv
Thanks.