tree to excel

Posted on 2013-08-28
Medium Priority
Last Modified: 2013-08-28
I am trying to capture all the directories (NAMES ONLY, and subdirectories) on a given network share.  I know i can do powershell and Get-ChildItem | tree > c:\tree.txt    but can someone help me get it so i can import it into excel in a nice layout so we can use it as a checklist?
Question by:bbimis
  • 3
  • 2
LVL 40

Expert Comment

ID: 39445462
Check the csv report format from following question and see if it works for you..

Author Comment

ID: 39445574
that looks great. I have one question though and I have no problem opening a new question if need be.  Here is ultimately what I need to figure out.

lets say i have

and they have files inside of them I want for each directory a csv file of all its file permissions
I have a powershell script that will do the WHOLE thing but i want it to go to one directory say apples and make a csv file called apples.csv  then when it finishes move on an make a csv file called oranges and so on.  Is this possible and if so can someone help me with the code.  this is what i have so far.

$path = 'F:\common’

$outFilename = Join-Path $path "Dir-$(Get-Date -Format 'yyyyMMdd-HHmmss').csv"

dir $path -attr !D -r | select Name, Extension, DirectoryName, Length, CreationTime, LastAccessTime, LastWriteTime | export-csv $outFilename -NoTypeInformation

Open in new window

LVL 40

Accepted Solution

Subsun earned 2000 total points
ID: 39445703
Try this and see if it works for you.. Results will be saved in C:\Temp..
$Path = "F:\common"
Foreach ($Dir in (GCI $Path | ?{$_.PSIsContainer})){
	GCI $Dir.FullName -Recurse | ?{!($_.PSIsContainer)} | % {
	$Perm = Get-Acl $_.FullName
	$_ | Select Name,Extension,DirectoryName,Length,CreationTime,LastAccessTime,LastWriteTime,`
			@{N="Owner";E={$Perm.Owner}},@{N="Access";E={$Perm.Access | Out-String}}
	} | Export-Csv "C:\Temp\$($Dir.Name)-$(Get-Date -Format 'yyyyMMdd-HHmmss').csv"

Open in new window


Author Comment

ID: 39445741
I've requested that this question be closed as follows:

Accepted answer: 0 points for bbimis's comment #a39445574
Assisted answer: 500 points for Subsun's comment #a39445462

for the following reason:

thank you so much that is exactly what i needed!!!!

Author Closing Comment

ID: 39445742
THANK YOU SO MUCH!!! This is what i needed!

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
Welcome to 2018! Exciting things lie ahead in the world of tech. To start things off, we compiled great member articles on how to stay safe, ways to learn, and much more! Read on to start your new year right.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question