bsb has asked for the wisdom of the Perl Monks concerning the following question:
Has anyone fine-tuned an expression to tidy up shell unfriendly filenames with rename? eg.$ rename Usage: rename [-v] perlexpr [filenames]
This is a start, but I'd prefer the ' - ' to become '-', there's the trailing "_", and there's no doubt more problem cases to be found. Before I started trying to DWIM for 98% of cases I figured someone else is bound to have been there before me.$ rename -v '$_=lc;s/[^\w.]+/_/g' * The Pogues - Beer, Beer, Beer (Irish drinking song).mp3 renamed as the +_pogues_beer_beer_beer_irish_drinking_song_.mp3
Anyone solved this already..?
Thanks,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Clean filenames with /usr/bin/rename
by thinker (Parson) on Jun 17, 2003 at 07:59 UTC | |
by bsb (Priest) on Jun 17, 2003 at 23:18 UTC | |
by parv (Parson) on Jun 18, 2003 at 00:38 UTC | |
|
Re: Clean filenames with /usr/bin/rename
by parv (Parson) on Jun 17, 2003 at 08:27 UTC | |
|
Soln: Clean filenames with /usr/bin/rename
by bsb (Priest) on Jun 20, 2003 at 00:59 UTC |