Re: The rename command…



2008/8/27 Rashkae <ubuntu@xxxxxxxxxxxxxxx>

Johnny Rosenberg wrote:


When I was searching for a solution to my problem (which I now consider
solved) I think I ran into a solution without the rename command… I
think
they used mv instead, but I can't find it.

Is there a reason not to use rename (such as it might be slow or
something,
maybe even incompatibility with non-Debian based systems)? I realise that
I
need regular expressions to achieve the name change, which makes rename
the
convenient choice, but there should be other ways, shouldn't it?

Unfortunately I never bookmarked the site where I found it (or THINK I
found
it…).

J.R.


There is a standard linux rename command. Unfortunately, Debian
replaces it with the Perl "prename". This is problematic because the
syntax between standard linux rename and prename is very different, and
therefore you can't write a script with rename that will work with
default debian distros and other distros. (you can search this list for
a recent long discussion I had with myself on the subject of rename)

ps: well, that's not technically true. You could write a script that
checks for the appropriate command and sets it as a variable, that would
work across distors, but I think you get my point.

When looking around on the web, I've seen a few sites where they mention the
"other" rename, but no one seems to use it very much. One person even
mentioned it as "pretty useless" or something like that…

I don't know very much about Perl, almost nothing at all, but isn't Perl a
programming language that doesn't use a compiler? Maybe I misunderstood, but
isn't the Perl rename thing written in Perl? 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?

That's why I asked for a solution without involving rename at all. Not that
it matters if renaming a few hundred files recursively in a folder with, in
my case about 21500 objects (files, links and folders), but I always think
that if I can make something faster, I should, at least if it doesn't take
too much time… In this case I learn something on the way, which I take as a
valuable bonus.

J.R.
--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


Relevant Pages

  • Re: Error returned on Unix mv system call.
    ... rename didnot work across the file system as it states ... in that case mv command is a saver.. ... Using Perl 5.8.7, the following legacy code ... Mail has the best spam protection around ...
    (perl.dbi.users)
  • Re: One liner for renaming files
    ... Alvarado wrote: ... > I am looking for a one line command that I could run with perl to ... >rename a group of files. ...
    (comp.lang.perl.misc)
  • rename and case insensitive filing systems
    ... It used the standard ... rename (oldfile, newfile); approach and I discovered, to my horror, some ... perl sucessfully deleted all the ... (Currently I am manually doing rename old TMP; rename TMP new which is just ...
    (comp.lang.perl.misc)
  • Re: getting rid of filenames with whitespaces
    ... > i'm using a Linux system running Samba as a filestore for a Windows client. ... > problem, but since some Unix commands cannot handle such files properly, ... Use the rename command, it's a perl script, that lets you use perl RE, ...
    (comp.os.linux.misc)
  • Re: file handle in perl
    ... I hear that Perl can do some of this stuff too. ... happens to file1 until that's finished. ... we rename file1 to file1.bak ... to do it yourself for more complex cases where a one-liner wouldn't cut it. ...
    (perl.beginners)