Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Change File Case Fast

0 views
Skip to first unread message

Eric Robinson

unread,
Nov 18, 2009, 6:59:10 AM11/18/09
to
We have a directory wity 2.2 million files, each having a long name
consisting of letters and numbers. We need to rename them all to lower case
FAST. I wrote a bash script to do it, but it processes files at about 1 per
30 seconds, I guess because the directory is so huge. (It runs fine on small
directories.)

Does anyone know a way to rename all these files fast?


jellybean stonerfish

unread,
Nov 18, 2009, 9:49:53 AM11/18/09
to

Have you tried "rename"?

Eric Robinson

unread,
Nov 18, 2009, 10:21:02 AM11/18/09
to
> Have you tried "rename"?

I don't see any available syntax in the rename command to change a file name
to the lower case version of itself.


Baron

unread,
Nov 18, 2009, 4:26:34 PM11/18/09
to
Eric Robinson wrote:

ToLower()

--
Best Regards:
Baron.

Eric Robinson

unread,
Nov 18, 2009, 6:56:13 PM11/18/09
to
>> I don't see any available syntax in the rename command to change a
>> file name to the lower case version of itself.
>
> ToLower()
>

Are we talking about the same rename command? The entire man page is very
short and does not have a ToLower() directive:

SYNOPSIS
rename from to file...

DESCRIPTION
rename will rename the specified files by replacing the first
occurrence of from in their name by to.

For example, given the files foo1, ..., foo9, foo10, ..., foo278, the
commands

rename foo foo0 foo?
rename foo foo0 foo??

will turn them into foo001, ..., foo009, foo010, ..., foo278.

And
rename .htm .html *.htm

will fix the extension of your html files.

SEE ALSO
mmv(1), mv(1)

1 January 2000
RENAME(1)
(END)


jellybean stonerfish

unread,
Nov 18, 2009, 11:42:36 PM11/18/09
to

If the files are just the easy characters:

rename 'y/A-Z/a-z/' *

I don't know if it will be fast.
Rename is almost like sed. From the sed manpage.

y/source/dest/
Transliterate the characters in the pattern space which appear
in source to the corresponding character in dest.

Robert Newson

unread,
Nov 19, 2009, 3:42:54 AM11/19/09
to
jellybean stonerfish wrote:
> On Wed, 18 Nov 2009 07:21:02 -0800, Eric Robinson wrote:
>
>>> Have you tried "rename"?
>> I don't see any available syntax in the rename command to change a file
>> name to the lower case version of itself.
>
> If the files are just the easy characters:
>
> rename 'y/A-Z/a-z/' *
Which version do you have? It doesn't work in mine:

$ ls
ANOTHER04 FILE01 FILE02 FILE03
$ rename 'y/A-Z/a-z/' *
$ ls
ANOTHER04 FILE01 FILE02 FILE03
$ rename --version
rename (util-linux-ng 2.14.1)

baron

unread,
Nov 19, 2009, 8:18:53 AM11/19/09
to
Eric Robinson Inscribed thus:

Its not part of the rename command. Its a function "tolower()"
I think Robert posted a possible command string.

--
Best Regards:
Baron.

jellybean stonerfish

unread,
Nov 19, 2009, 9:14:27 AM11/19/09
to

On looking, I see that my "rename" is really a symlink to
the perl v5.10.0 script "prename". My util-linux version
of rename is called "rename.ul". With some tests I find
you are correct. It isn't very powerful, but probably faster
than the perl version for simple renames.

0 new messages