rename files&folders to lowercase script for Linux pleas

For system help, all hardware / software topics NOTE: use Coders Corner for all coders topics.

Moderators: Krom, Grendel

Post Reply
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

rename files&folders to lowercase script for Linux pleas

Post by Diedel »

Can someone here give me a Linux script/command to recursively rename files and folders to lowercase please?
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

Code: Select all

for i in `ls PATTERN`; 
do mv $i $(echo $i | tr [A-Z] [a-z]); 
done
replace PATTERN with, im guessing, -r dirname/*

google for \"bash rename lowercase\" for more stuffs
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Thx flip. :)
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Doesn't work recursively because the folders aren't put in front of each filename by ls, but it saves enough work to rename each folder's contents already.
Post Reply