Can't replace PowerShell 2.0 filenames
I have files like this.
[mix]aaaa.flv
[mix]aaaa.mpv
[mix]aaaa.ogv
[mix]aaaa.webm
[mix]bb.flv
[mix]bb.mpv
[mix]bb.ogv
[mix]bb.webm
...
I just need to remove " [mix]
" from the filenames.
I am using this command but failed
Dir | Rename-Item โNewName { $_.name โreplace "[mix]", "" }
The error says
Rename-Item : 'Microsoft.PowerShell.Core\FileSystem::C:\Users\Desktop\[mix]aaaa.mp4'์ ํญ๋ชฉ์ด ์์ผ๋ฏ๋ก ์ด๋ฆ์ ๋ฐ๊ฟ ์ ์์ต๋๋ค.
์์น ์ค:1 ๋ฌธ์:18
+ Dir | Rename-Item <<<< โNewName { $_.name โreplace "[mix]","" }
+ CategoryInfo : InvalidOperation: (:) [Rename-Item], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand
There is an error code in the code, it can say: Can't change name, there is no item at 'Microsoft.PowerShell.Core\FileSystem::C:\Users\Desktop\[mix]aaaa.mp4'
And I don't understand what I am doing wrong. I used to change filenames with this command.
+3
source to share
2 answers