[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Stupid unix



On 24 Jul 1998, Joerg Plate wrote:

> > Is there a simple way to change all filenames in a directory so they
> > are lowercase?
> 
> 1> cat /usr/local/bin/rename
> #!/usr/bin/perl -Tw
> 
> use locale;
> [...]

Why not, in bash:

for f in $(ls); do
oldName=$f
newName=$(echo $oldName | tr [A-Z] [a-z])
mv -i $oldName $newName
done

I'd not bother with the variable names, but they make it clearer.

Disclaimer: I didn't test the above, and may have gotten the tr syntax
wrong.  But you get the idea.

--Eric House

+-------------------------------------------------------------------------+
|            from the desktop of: Eric House, fixin@peak.org              |
|    "The instructions said 'Win95 or better' -- so I installed Linux"    |
+-------------------------------------------------------------------------+


--  
Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null


Reply to: