Gentoo Archives: gentoo-user

From: Etaoin Shrdlu <shrdlu@×××××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Change the case of file names
Date: Mon, 02 Jul 2007 21:27:42
Message-Id: 200707022319.15051.shrdlu@unlimitedmail.org
In Reply to: [gentoo-user] Change the case of file names by Mick
1 On Monday 2 July 2007 22:59, Mick wrote:
2 > Hi All,
3 >
4 > I backed up my wife's WinXP fs using K3B and I used default settings
5 > which unfortunately converted all file names to CAPITALS and shortened
6 > them to 8 characters maximum, just like DOS would do. Is there a
7 > clever way to change some of them back to lower case (in batches
8 > within given directorates) so that she doesn't have to do it manually
9 > one by one? I do not want to change the access times, only the
10 > filename case letters.
11
12 Assuming there are no spaces in the names, something like:
13
14 cd $targetdir
15
16 for n in *; do
17
18 newname=`echo $n | tr -s 'A-Z' 'a-z'`
19 mv $n $newname
20
21 done
22
23 should work. It might be possile to do the same using bash alone, but I'm
24 too lazy to check now.
25 --
26 gentoo-user@g.o mailing list