![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Piping dir to tree I'm trying to create Word documents containing the output of a "tree" command... we need to make a sitemap of our website's actual structure to compare it to the theoretical structure. For each folder under webroot/dept/ I would like a separate file with the output of the "tree" command. What am I doing wrong? When I invoke the following command inside the /dept folder it does absolutely nothing... doesn't even throw an error. dir | foreach {tree >$_.doc} Thanks! Steven L Smith |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Piping dir to tree
directory, and then do a tree. Try this: pushd get-childitem . -recurse| where-object{$_.psiscontainer}| foreach-object{set-location $_.fullname;$_.fullname;tree} popd Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com | ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||
| Guest | Re: Piping dir to tree On May 15, 10:31 am, Steven Smith <ssmith46_from_naz_edu> wrote:
I think this is what you want: Get-ChildItem -Recurse | Where-Object { $_.PSIsContainer } | ForEach- Object { tree $_ > "$( $_.Name ).doc" } The Where-Object Cmdlet is there to make sure tree only processes directories. Take out the Recurse parameter if you only want the directories directly under your current directory. Jeff | ||||||||||||
My System Specs![]() | |||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Piping regex match to commands | Klaus H. Probst | PowerShell | 2 | 07-24-2008 03:36 PM |
| What is the syntax for piping LiteralPath to Get-ChildItem | Bob Landau | PowerShell | 6 | 10-05-2007 10:59 PM |
| piping/redirect to file slow | Ben Schwehn | PowerShell | 10 | 09-19-2007 07:34 AM |
| All about piping | Marco Shaw | PowerShell | 2 | 11-20-2006 11:20 AM |
| New to ps object piping | Adam Murray | PowerShell | 2 | 09-14-2006 02:14 AM |