Re: The rename command…

Johnny Rosenberg gurus.knugum at gmail.com
Wed Aug 27 20:42:21 UTC 2008


2008/8/27 Rashkae <ubuntu at tigershaunt.com>

> Johnny Rosenberg wrote:
> > 2008/8/27 Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl>
> >
> >> 2008/8/27 Johnny Rosenberg <gurus.knugum at gmail.com>:
> >>
> >>> If so, shouldn't that mean that
> >>> rename is quite a lot slower than it would be if it was written in, for
> >>> example, C, like I think the rest of the Unix/GNU/Linux commands are,
> >> such
> >>> as mv?
> >> For an individual call it is slower, but when renaming many files with
> >> one pattern I guess rename would be faster (mv can only rename one
> >> file at a time).
> >>
> >> --
> >> Marcin Kowalczyk
> >>  <qrczak at knm.org.pl>
> >>
> > But still, if someone "translated" rename to C and compiled it, it would
> be
> > even faster, right? Which should be possible, because the source code for
> > rename is available somewhere, isn't it? I don't know, only guessing…
> >
>
> prename is just a perl script... the source is the command itself. open
> it with a text editor..
>
> Perl is pretty fast at what it does, and perl is written in C.  For the
> sake of such a small program, it's really not worth doing more.  I bet
> your filesystem will be slower actually updating the filenames than perl
> will be executing 1 string substitution.
>
> Ok, so I guess I misundersttod it totally. Just to make this clear (for
me): I thought rename (or prename as it also seems to be called, but "man
prename" took me to the "rename" man pages) was some kind of program written
in Perl, but you say that rename is actually one of the standard Perl
commands/instructions? Or am I misunderstanding again?

Sorry, being a beginner, especially when it comes to Perl, which I never
used (or obviously I did now…).

In any way I am going to do a little speed test, which I will write back
about soon. I've just created 342 links that I am going to test with. Why
342? Well, I have a folder with 342 files in it, and I just created a new
folder and drag those files to it with Ctrl and Shift pressed. Then I made a
tar.gz-file containing those links, so after each test, I just erase the
renamed links and extract that tar.gz file again for a new fresh start, so
that every command gets the same environment, as much as possible, My
intention is to test each command 5 times, in case of unpredictable
circumstances. I'll be back about that. So far I tested the mv alternative,
and it was SLOW! Over 2 seconds for searching 22000 files and renaming 342
of them. Hopefully the other methods are faster.

J.R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080827/062a59c5/attachment.html>


More information about the ubuntu-users mailing list