You are not logged in.

#1 2009-11-19 22:53:42

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

"rename" default implementation in Arch

Hi there wink

As far of I know, most of recent systems use the "rename" script from larry Wall ( Perl dad ).

Why don't using it as default "rename" like most of modern systems ? hmm 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. I'm pretty sure I'm not the first one, and not the last one too.

( 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 I use a custom ~/bin dir for that kind of stuff  or see aur/perl-rename )

See ya.

Last edited by sputnick (2009-11-20 00:49:30)

Offline

#2 2009-11-19 23:02:53

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

Re: "rename" default implementation in Arch

The "rename" binary that I have on my system comes for util-linug-ng.  What is better about the perl version?

Offline

#3 2009-11-19 23:12:00

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

Re: "rename" default implementation in Arch

"rename" from util-linug-ng is a simplified less powerfull tool. Moreover, the well known syntax 's/pattern/other-pattern/'  doesn't fit with this package. The perl version can do complex substitutions with ( back references ), like this example from another post :
rename -v 's/\w+\.(\dx\d+)\.(.+)\.german.*\.(\w{3,})/$1 - $2.$3/' *

Offline

#4 2009-11-19 23:30:25

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: "rename" default implementation in Arch

http://aur.archlinux.org/packages.php?ID=15512

The package is orphaned so you can adopt and maintain it if you like.


@Allan
I haven't used it, but a rename binary that supports Perl regular expressions would be orders of magnitude more powerful than the default one.

*heads off to play with Perl scripts*


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#5 2009-11-19 23:56:10

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

Re: "rename" default implementation in Arch

@Xyne : prename is an extract of debian package, it's not needed. The good one is perl-rename http://aur.archlinux.org/packages/perl- … e/PKGBUILD and it's quite maintened.

I like Arch in part because it use powerfull modern tools and keep users to decide what is good or not ( like non-free stuff ).
Using something different of Perl rename doesn't makes sense for me, and I think some others users and sysadmins too.

Edit : Debian default is Larry Wall original script with small changes, his name under debian is prename.
That's what my debian chroot said :

# echo 'readlink -f $(type -p rename)' | chroot /home/chroot bash -s
/usr/bin/prename

The perl-rename ( PKGBUILD based on CPAN ) is an improved one, ( written by Peder Stray, original script from Larry Wall ) the help output confirm that ( code too ):

 # /usr/bin/perlbin/site/rename --help
Usage: rename [OPTION]... PERLEXPR FILE...
Rename FILE(s) using PERLEXPR on each filename.

  -b, --backup                 make backup before removal
  -f, --force                  remove existing destinations, never prompt
  -i, --interactive            prompt before overwrite
  -S, --suffix=SUFFIX          override the usual backup suffix
  -v, --verbose                explain what is being done
  -V, --version-control=WORD   override the usual version control
  -n, --just-print, --dry-run  don't rename, implies --verbose
  -l, --link-only              link file instead of reame
      --help                   display this help and exit
      --version                output version information and exit

The backup suffix is ~, unless set with SIMPLE_BACKUP_SUFFIX.  The
version control may be set with VERSION_CONTROL, values are:

  t, numbered     make numbered backups
  nil, existing   numbered if numbered backups exist, simple otherwise
  never, simple   always make simple backups

Report bugs to pederst@cpan.org

debian (p)rename :

 # chroot /home/chroot rename --help
Unknown option: help
Usage: rename [-v] [-n] [-f] perlexpr [filenames]

Last edited by sputnick (2009-11-20 01:39:03)

Offline

#6 2010-01-09 15:00:19

rekado
Member
From: Shanghai, China
Registered: 2009-01-13
Posts: 98
Website

Re: "rename" default implementation in Arch

The perl rename has proven to be enormously helpful in renaming mixed-case filenames and directories (happens when copying stuff from windows from a FAT-formatted disk) to lowercase. I was wondering for a while why the 'rename' tool in my Arch install didn't work as advertised on numerous forums. Thanks to this thread I know now.

Offline

Board footer

Powered by FluxBB