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

link|improve this question

67% accept rate
feedback

1 Answer

up vote 2 down vote accepted

Debian comes with a program called prename which can rename files using regexes:

prename 's/^\[.+?\] *//; s/ \(.+?\)$//' *
link|improve this answer
Use -v for verbose and -n to preview the results (and do nothing). This way you can check the result first. – Geoff Mar 23 '11 at 19:50
thanks a lot you two :) – allenskd Mar 23 '11 at 22:51
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 '11 at 21:10
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.