We help IT Professionals succeed at work.

powershel lto get the names of folders on a server share

gd6627
gd6627 asked
on
320 Views
Last Modified: 2014-11-25
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
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
MontoyaProcess Improvement Mgr
CERTIFIED EXPERT

Commented:
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.
CERTIFIED EXPERT

Commented:
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.

Author

Commented:
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
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
thank you so much
CERTIFIED EXPERT

Commented:
Happy to help.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.