Way to uncapitalize all files in *nix?

Entity

Lifer
Oct 11, 1999
10,090
0
0
I'm looking to move a bunch of files using capital letters to a different location, and make all of them uncapitalized. Is there any way to write a script to do this, without PERL?

thanks
Rob
 

cureless

Member
Apr 25, 2001
94
0
0
Easy.

for file in `ls`; do mv $file `echo $file | tr '[A-Z]' '[a-z]'` ; done

Careful with the back quotes. Also, it will give you a warning/error if the file is already in lower case or if the file in lower case exists.

cl
 

Damaged

Diamond Member
Oct 11, 1999
3,020
0
0
open editor:

#!/bin/sh
for file in `ls`; do mv $file `echo $file | tr '[A-Z]' '[a-z]'` ; done

make it executable, name it, run it. ./<name>