on-internet
← Community

Remove all characters between brackets and the brackets as well from file names

Stack Overflow ·

I have a lot of file(s) that have random text between square brackets eg: [a9b7a=9sd09] and would like a quick way to remove the text and the brackets from all files within a certain directory. The text between brackets is always random and I've looked at sed substitution, rename (Python script), krename and other ideas but I haven't had any luck yet. Most one liners get complaints from fish shell and therefore most scripts I try fail. I've come from How do I Remove Specific Characters From File Names Using BASH and Removing special characters from file names bash script and other posts like t

Comments

Sign in or sign up to comment and upvote.

No comments yet.