0

I like to develop a script that modify a folder name when the lvl up folder name endings can changed . ususully in ps im just using a wild card like this Something.*

but using this inside a reanme-item command does not works . i am getting :

name-Item : Cannot process argument because the value of argument "path" is not valid. Change the value of the "path" argument and run the operation again. At line:1 char:1

  • 4
    Welcome to StackOverflow. Please take some time to read: [How to ask](https://stackoverflow.com/help/how-to-ask) and add the specific code that is failing to the question. – iRon Jan 31 '21 at 15:09
  • Please note, the error is due to you not supplying the path. That's a common mistake I see often where users think it's suffice to provide just the name. If you're recursing from the root directory of C:\, and you're piping it to a `foreach{rename-item $_.Name -NewName "new name"}` this doesn't work. Why? You're referencing just the name, in which, unless there are files in the root of C:\ with those names, they won't be changed. You have to supply the full path using `$_.fullname` to let ps now what and where to rename the from. – Abraham Zinala Jan 31 '21 at 17:41

1 Answers1

1

Without examples of your code it's not completely clear what your usage is. There is a similar recent question/answer here that may help Powershell Changing Bulk File Extensions All At Once

Daniel
  • 4,792
  • 2
  • 7
  • 20