1

I have a bunch of files (around 900) that have some special characters.

Some of the files contains example, and quoting "[useless] filename (something)" so what I want is just to strip the brackets and parenthesis, some are folders, others are text files

1 Answer 1

2

Debian comes with a program called prename (also known as perl-rename) which can rename files using Perl-style regexes:

prename 's/^\[.+?\] *//; s/ \(.+?\)$//' *
2
  • Use -v for verbose and -n to preview the results (and do nothing). This way you can check the result first.
    – Geoff
    Mar 23, 2011 at 19:50
  • sorry, my regex skill sucks so I ask.. there are some files with brackets parenthesis on both sides, but that code only removes the starting line :(
    – allenskd
    Mar 24, 2011 at 21:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .