Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Powershell Directory list but exclude files.

$
0
0

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.


Viewing all articles
Browse latest Browse all 6937

Trending Articles