Q:

I want to remove recursively square brackets from file names

I have a lot of files in a directory containing square brackets for example:
Filename 1 [12454365].txt

I tried the following script but it's giving me the an error. 
get-childitem -recurse | foreach { move-item -literalpath $_.name ($_.name -replace '\[.*\]', '')}

Error message
move-item : A device attached to the system is not functioning. 

Only want to remove square brackets not everything in between! 

A:

I believe the issue is that you are replacing the brackets and everything in between. 
Get-ChildItem * -Filter "*`[*`]*" | Rename-Item -NewName { $_.name -replace '\[','' -replace '\]','' }

