I have a series of folders, named as follow
[[1254170]][folder1]
[[1212340]][folder2]
[[3245417]][folder3]
I want to rename them all as
[1254170]folder1
[1212340]folder2
[3245417]folder3
or at least
[1254170][folder1]
[1212340][folder2]
[3245417][folder3]
I edited the batch command I learned from a question I asked a year ago.
Get-ChildItem -path . -directory -recurse | Where {$_.Name -match '^\[\[\d\]\]'} | Rename-Item -NewName {$_.Name -replace '^\[\[\d\]\]','^\[\d\]'}
The command went through but nothing happened.
I also tried an edited version of the command from this answer
Get-ChildItem * -Filter "*`[`[*`]`]*" | Rename-Item -NewName { $_.name -replace '\[\[','\[' -replace '\]\]','\]' }
and I got this error
Rename-Item : Cannot rename the specified target, because it represents a path or device name.
At line:1 char:41
+ ... `[*`]`]*" | Rename-Item -NewName { $_.name -replace '\[\[','\[' -repl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Rename-Item], PSArgumentException
+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.RenameItemCommand
Someone help me please? I am using Windows 11. Thank you.