You are not logged in.

#1 2007-05-13 00:00:03

ict
Member
Registered: 2007-05-01
Posts: 44

No (p)rename in Arch?

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

#2 2007-05-13 14:06:21

kanpio
Member
From: Poland/Wrocław
Registered: 2006-01-25
Posts: 49

Re: No (p)rename in Arch?

How about using krename, very simple and useful application. And it's in repos.

Offline

#3 2007-05-13 14:17:45

ict
Member
Registered: 2007-05-01
Posts: 44

Re: No (p)rename in Arch?

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

#4 2007-05-13 19:16:26

Phrodo_00
Member
From: Seattle, WA
Registered: 2006-04-09
Posts: 342
Website

Re: No (p)rename in Arch?

there IS rename, when I get to my box I'll ask pacman what package owns it

Offline

#5 2007-05-13 22:23:36

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: No (p)rename in Arch?

It's in the util-linux package.

Offline

#6 2008-03-04 23:57:03

G_Syme
Member
Registered: 2007-01-04
Posts: 83

Re: No (p)rename in Arch?

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. smile

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

#7 2008-03-05 03:27:07

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: No (p)rename in Arch?

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

#8 2008-03-05 04:24:41

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: No (p)rename in Arch?

or just use plain perl?

ls | perl -nle' $orig=$_; /$your_smart_regex_goes_here/; rename($orig,$_);'

Offline

#9 2009-11-19 22:31:59

sputnick
Member
From: Near Paris
Registered: 2009-05-27
Posts: 40

Re: No (p)rename in Arch?

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

#10 2009-11-19 22:36:03

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: No (p)rename in Arch?

Welcome to the forums.  I suggest you read this: http://wiki.archlinux.org/index.php/For … Bumping.27 .

Closing

Offline

Board footer

Powered by FluxBB