Date: Thu, 18 May 2006 19:47:47 +0200 From: Simon Olofsson <simon@olofsson.de> To: Kyrre Nygard <kyrreny@broadpark.no>, freebsd-questions@freebsd.org Subject: Re: Shell script cannot run on FAT32 partition Message-ID: <446CB343.9050206@olofsson.de> In-Reply-To: <7.0.1.0.2.20060518123424.02289418@broadpark.no> References: <7.0.1.0.2.20060518123424.02289418@broadpark.no>
next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, FAT32 can't distinguish between upper and lowercase. You need to use an intermediate filename to do so. Take a look at lcra: http://membled.com/work/apps/lcra/lcra-1.0.1/lcra HTH on 05/18/2006 12:40 Kyrre Nygard said the following: > > Hello! > > I have this nice renaming script here. > It sanitizes badly named parts of files and folders. > > But when I run it on my FAT32, dual boot transition partition (hehe), it > causes > my computer (Pentium 4, 3,2 GHz) to freeze. I vaguely remember seeing some > message before it freezes saying "Locking from myself" or something like > that, > this is not recorded into /var/log/messages. > > It is very annoying actually because to rename a bunch of files I first > have to > copy them to my UFS2 partition, run the script, and then copy them back > to the > FAT32 partition. > > Does this problem sound familiar to anyone? > > Thanks! > > Anyway here is the script. > > #!/usr/local/bin/bash > # > # Rename files and folders in MP3 releases. > # $MERHABA: mp3_rename.sh,v 1.0 2007/11/11 15:09:05 kyrre Exp $ > # > > if [ $1 ]; then mv="echo"; else mv="mv"; fi > > function do_folders () { > > for old in *; do > > if [ -f "$old" ]; then do_files "$old" > elif [ -d "$old" ]; then > > new=`echo "$old" | tr "[:upper:]" "[:lower:]"` > new=`echo "$new" | sed -e "s/ /_/g" \ > -e "s/)//g" \ > -e "s/-(/-/g" \ > -e "s/_(/-/g" \ > -e "s/(//g" \ > -e "s/_-_/-/g" \ > -e "s/---*/-/g" \ > -e "s/___*/-/g" \ > -e "s/\./_/g" \ > -e "s/,/-/g" \ > -e "s/'//g" \ > -e "s/___*/_/g" \ > -e "s/_-/-/g" \ > -e "s/-_/-/g" \ > -e "s/&/and/g" \ > -e "s/\([-_]\)ft[_-]/\1feat_/g" \ > -e "s/\([-_]\)featuring[_-]/\1feat_/g" \ > -e "s/[][]//g"` > > if [ "$old" != "$new" ]; then $mv "$old" "$new"; fi > > echo "Renaming $old" > > cd "$new"; do_folders "$new"; cd .. > > else echo "Directory invalid."; fi > > done > } > > function do_files () { > > old=$1 > > new=`echo "$old" | tr "[:upper:]" "[:lower:]"` > > if [[ "$old" == *.* ]]; then > > extension=${new##*.} > new=${new%.*} > > new=`echo "$new" | sed -e "s/ /_/g" \ > -e "s/)//g" \ > -e "s/-(/-/g" \ > -e "s/_(/-/g" \ > -e "s/(//g" \ > -e "s/_-_/-/g" \ > -e "s/---*/-/g" \ > -e "s/___*/-/g" \ > -e "s/\./_/g" \ > -e "s/,/-/g" \ > -e "s/'//g" \ > -e "s/___*/_/g" \ > -e "s/_-/-/g" \ > -e "s/-_/-/g" \ > -e "s/\&/and/g" \ > -e "s/\([-_]\)ft[_-]/\1feat_/g" \ > -e "s/\([-_]\)featuring[_-]/\1feat_/g" \ > -e "s/^\([0-9]\{2,3\}\)_/\1-/g" \ > -e "s/[][]//g"` > > new=`echo "$new"."$extension"` > > $mv "$old" "$new"; fi > } > > do_folders . - -- Mit freundlichem Gruß, With best regards, Simon Olofsson http://olofsson.de GPG-Key: 0x3D001BE0 http://olofsson.de/simon/keys/simon_olofsson.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEbLNARM/k9z0AG+ARAsy/AKCTZ74GYB9lQbVshtB/RiMSbWoShQCg85Nr A2iRe7zu3GOyrya3J8QtUm4= =Av5z -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?446CB343.9050206>