So there's a problem I am trying to solve and I don't know if this is the way to go about it.
Basically I have a folder structure that looks like:
\---folder
\---subfolder1
+---subsub1
| +---subsubsub1
\---subsub2
\---subsubsub2
And I want it to look in excel like this: link to excel screenshot
I am aware that the tree
command in Powershell or command prompt gives the above text output, which is how I got it. I am trying to now format the output of the command so that it contains spaces and tabs instead of the +'s, 's, |'s and -'s that it has. Then I can import this into excel to get the output I'm looking for in that screenshot
In my PS script, I am currently able to replace the -'s with spaces but the +,\ and | symbols turn out to be special characters that aren't replaced as easily.
It's possible that what I'm trying to accomplish can be done through much easier means, and if so I'm open to ideas, but this is the way I've been trying to approach this.
Here's what I have so far for Powershell code:
$filename = "test.txt"
tree /a > $filename
get-content $filename | %{$_ -replace "-"," "}
get-content $filename | %{$_ -replace [RegEx]::Escape('< SharedPassKey=123456789abcdefghi/JKLM+nopqrst= />'),'< SharedPassKey=123456789abcdefghi/JKLM.nopqrst= />'}
Some things that I run into so far: