PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : grossschreibung => kleinschreibung


Lord_X
2004-06-20, 17:31:03
Hallo zusammen :)

Wie kann ich alle Dateien und Unterverzeichnisse die gross geschrieben sind klein schreiben?

Danke

Xanthomryr
2004-06-20, 18:01:54
Quelle (http://www.gentoo.org/news/en/gwn/20040510-newsletter.xml#doc_chap5)

Often files need to be converted from uppercase to lowercase. Sometimes this is a side effect of moving from case-insensitive file systems to case-sensitive ones.

Here's a quick shell command that will convert everything in the current directory from uppercase to lowercase.
for n in *; do mv $n `echo $n | tr '[:upper:]' '[:lower:]'`; done
Wie man das aber rekursiv hinbekommt kann ich dir leider nicht sagen.

Lord_X
2004-06-20, 18:25:07
Danke perfekt :up:

Hab das noch bekommen.



#! /bin/bash
#
# Changes every filename in working directory to all lowercase.
#
# Inspired by a script of John Dubois,
# which was translated into into Bash by Chet Ramey,
# and considerably simplified by Mendel Cooper, author of this document.


for filename in * # Traverse all files in directory.
do
fname=`basename $filename`
n=`echo $fname | tr A-Z a-z` # Change name to lowercase.
if [ "$fname" != "$n" ] # Rename only files not already lowercase.
then
mv $fname $n
fi
done

exit 0