Link to home
Start Free TrialLog in
Avatar of gd6627
gd6627Flag for United States of America

asked on

powershel lto get the names of folders on a server share

Hello, I need to figure out the contents of a folder share , I need to get the folder names of the folders in that share , then export them to a csv file.

so if the folder share is \\servername\e$
 then I like the script to give me a list of folders say starting with a like name of ABC so that I get all folders starting with ABC in that share
ASKER CERTIFIED SOLUTION
Avatar of becraig
becraig
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Montoya
Montoya

try dir | where {$_.PsIsContainer}


There's a great article here:
http://blogs.msdn.com/b/powershell/archive/2006/06/24/645000.aspx

That goes deeper.
I need to edit
gci \\servername\e$ -recurse  | ? {($_.psIsContainer ) -and ($_.name -like "ABC*")} | select Name | export-csv c:\file.csv -nti

Open in new window

                                         
I forgot to recurse.
Avatar of gd6627

ASKER

Thanks guys ,

Becraig how do I get it so that I don't get the mode and the last write times I just need the names of the folders
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gd6627

ASKER

thank you so much
Happy to help.