On Tue, 17 Apr 2007, Masatran, R. Deepak wrote:
Since I frequently receive files from Microsoft Windows users, is there any
utility to unix-ify file names, that is, use lower case exclusively, use
hyphen as separator, etc.?
--
Masatran, R. Deepak <http://research.iiit.ac.in/~masatran/>
Not directly, but it's easy enough to do:
#!/bin/sh
#change spaces to hyphens
rename 's/\ /-/g' *$1
#uppercase to lower
for FILE in `ls *$1` ; do
filename=`basename $FILE`
newfile=`echo $filename | tr A-Z a-z`
if [ "$filename" != "$n" ] ; then
mv $filename $newfile
fi
done
---
$ ls
New Files.TXT SOME New Files.TXT
$ sh ~/unixfy.sh TXT
$ ls
new-files.txt some-new-files.txt
-+-
8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Techno.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]