how to change file name to folder name RRS feed

  • Question

  • Hi Guys

      I have a folder constructed as below




      and so on, and in each usrX foler, there was local.csv file , so now what i want was to change the local.csv in each folder to the usera.csv , userB.csv and so on , can powershell do this ?

    • Moved by Bill_Stewart Friday, November 28, 2014 5:25 PM Unanswerable help vampire question
    Tuesday, November 4, 2014 1:52 AM


All replies

  • Absolutely.  PowerShell is perfect for changing things.

    Start here:

    Post back with specific questions.


    • Proposed as answer by jrv Tuesday, November 4, 2014 2:22 AM
    • Marked as answer by Just KarlModerator Thursday, April 30, 2015 4:52 PM
    Tuesday, November 4, 2014 2:22 AM
  • Here is a hint as to how to do this but ther is not enough information to determine exactly how to do it.

    dir c:\rootfolder -directory |
               rename-item "$($_.Fullname)\local.csv" "$($_.Basename).csv"


    • Edited by jrv Tuesday, November 4, 2014 2:36 AM
    Tuesday, November 4, 2014 2:35 AM