Get-ChildItem to get Directories RRS feed

  • Question

  • I'm using the below code to get a list of all the directories within a path.  I need to either delete/add or change an item with the var.

    $dirs = 'C:\dir.txt'
    $r = Get-ChildItem -Path "C:\mydata" | ?{$_.PSIsContainer} |Select-Object Name -expandProperty Name

    This works great, however I have a folder called !Orig that I need to rename to just Orig, before sending the var out as a text file.

    Not sure how to accomplish this.



    Wednesday, July 20, 2016 6:04 PM


All replies