You are not logged in.

#1 2008-02-28 23:49:07

Falcata
Member
From: Michiana
Registered: 2008-01-23
Posts: 501
Website

Recursive Case Reduction

I need a way to quickly cause every file within a folder to have it's name changed to lower case, along with all of the folder's subdirectories and the directories/files within them.  Is there a command to do this, or does it need a shell script to work?

Offline

#2 2008-02-29 01:25:30

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Recursive Case Reduction

KRename or zsh's zmv (zmv '(**/)' '${(L)1}') comes to mind.

Offline

#3 2008-02-29 02:17:20

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

Re: Recursive Case Reduction

You can do this with coreutils, but perl is so much more comfortable to me:

find . | perl -nle '$f = $_; s|$ENV{PWD}/||; rename($f, lc)'

(note: not really tested)

Offline

#4 2008-02-29 04:31:40

Falcata
Member
From: Michiana
Registered: 2008-01-23
Posts: 501
Website

Re: Recursive Case Reduction

Using command you suggested, I was able to change most of the files to lowercase.  The only ones that didn't change their name were the ones that had spaces in their name.  I need those files changed as well, but for now I'm going to change them manually.

EDIT: I take that back.  The files it missed were all of the files within subdirectories.

Last edited by Falcata (2008-02-29 04:33:24)

Offline

#5 2008-02-29 05:36:27

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: Recursive Case Reduction

Here are some ideas: http://gentoo-wiki.com/TIP_lowercase_fi … irectories

I tried the "convmv" method with "-r" switch added ("convmv -r --notest --lower *") and apparently it works fine.

Offline

#6 2008-02-29 13:36:29

Falcata
Member
From: Michiana
Registered: 2008-01-23
Posts: 501
Website

Re: Recursive Case Reduction

It seems to have very well, even affecting the files that had spaces in their names.

Also, why is it saying my version of perl has fleas?

Last edited by Falcata (2008-02-29 13:36:53)

Offline

Board footer

Powered by FluxBB