You are not logged in.
Pages: 1
Topic closed
Hi.
I just wanted to rename some mp3s I had lying around and wanted to do this with perl-expressions. Back in Ubuntu I just had to run "rename", which would take a Perl-like Regular expressions (complete with tokens and backreferences) and a file scheme and would throw every filename against that expression and rename the file accordingly. Link to Original Article that led me to that app
But the Arch-'rename' tool is much less capable of doing the tasks I need done.
After booting back in Ubuntu I found out that the rename-tool I had been using was actually "prename". I didn't find much info on the net about it so I just copied the binary back in Arch and it worked.
But I think such a great tool should be included in Arch. So if anyone knows something about prename post here so maybe I could make a package in AUR or so.
Offline
How about using krename, very simple and useful application. And it's in repos.
Offline
Yes I tried that, but it doesn't support backreferences.
For example, if I have the file
"Scrubs.5x11.Mein.Kummer.german.TvR.DVB.[some.url.ru].mpg" and wanted to rename it to "5x11 - Mein Kummer.mpg"
I'd use
rename -v 's/\w+\.(\dx\d+)\.(.+)\.german.*\.(\w{3,})/$1 - $2.$3/' *
and then another run with s/./ / to get rid of the dots.
I have found no way in Krename which could do that. For simpler tasks it is indeed very useful.
Offline
there IS rename, when I get to my box I'll ask pacman what package owns it
Offline
It's in the util-linux package.
Offline
prename seems to be part of the debian project.
In debian, it's part of the perl package. It's not in the original perl source, but separately added in the debian specific diff file. As ubuntu is based on debian, that would explain why they're using prename per default.
I don't know why they don't include it as a separate file, but you have to extract the program from the diff.
Fortunately, I've already succeeded in doing so, and have posted a package to the AUR.
As I'm not aware of any way to manage alternatives in Arch (like in e.g. debian or gentoo) I've simply left it as prename.
Have fun!
The courageous enter dark caves alone.
The clever send in the courageous first.
The cleverest wait behind the clever.
Offline
just a simple script makes for a good renaming tool:
if [ ! -z "$1" ]; then
for F in *; do
if [ ! -z "$3" ]; then
mv $F $1$2$((++N)).$3
else
mv $F $1$2$((++N))
fi
done
eg. for all files in dir randomly named you run "$scriptname/$functionname linux 1 txt" and you have linux1.txt linux2.txt ...
I need real, proper pen and paper for this.
Offline
or just use plain perl?
ls | perl -nle' $orig=$_; /$your_smart_regex_goes_here/; rename($orig,$_);'
Offline
I know it's a old thread, but the search tool is still there.
Why don't using Larry Wall perl script as default rename like moderns systems ? I use Debian/redhat systems most of the time @work, and I was wasting some time to understand that Arch implement rename in an other way.
For thoses wanting the original perl script from Perl dad, download http://search.cpan.org/CPAN/authors/id/ … 1.6.tar.gz and add it in your $PATH before /usr/bin
Offline
Welcome to the forums. I suggest you read this: http://wiki.archlinux.org/index.php/For … Bumping.27 .
Closing
Offline
Pages: 1
Topic closed