Remove parenthesis and brackets from multiple directories
Solution 1:
You can use rename
to remove any of those characters wherever they occur with alternation
rename -n 's/\(|\[|\]|\)//g' *
You need to escape the brackets and parentheses.
Remove -n
after testing to really do the renaming.
To remove all the characters within brackets or parentheses
rename -n 's/\(.*\)|\[.*\]//g' *
To also remove spaces (to change (1234) ABC [xyz]
to ABC
)
rename -n 's/\(.*\)|\[.*\]| //g' *