From owner-freebsd-questions@FreeBSD.ORG Thu May 18 17:47:51 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E372F16A416 for ; Thu, 18 May 2006 17:47:50 +0000 (UTC) (envelope-from simon@olofsson.de) Received: from mail-in-03.arcor-online.net (mail-in-03.arcor-online.net [151.189.21.43]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3765643D4C for ; Thu, 18 May 2006 17:47:49 +0000 (GMT) (envelope-from simon@olofsson.de) Received: from mail-in-02-z2.arcor-online.net (mail-in-02-z2.arcor-online.net [151.189.8.14]) by mail-in-03.arcor-online.net (Postfix) with ESMTP id 9D20B16EF2E; Thu, 18 May 2006 19:47:48 +0200 (CEST) Received: from mail-in-04.arcor-online.net (mail-in-04.arcor-online.net [151.189.21.44]) by mail-in-02-z2.arcor-online.net (Postfix) with ESMTP id 7DA3C1C86AF; Thu, 18 May 2006 19:47:48 +0200 (CEST) Received: from gul.lan.gath3n.de (dslb-084-060-166-188.pools.arcor-ip.net [84.60.166.188]) by mail-in-04.arcor-online.net (Postfix) with ESMTP id 30BA211CD7B; Thu, 18 May 2006 19:47:48 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by gul.lan.gath3n.de (Postfix) with ESMTP id ED9955C70; Thu, 18 May 2006 19:47:47 +0200 (CEST) Message-ID: <446CB343.9050206@olofsson.de> Date: Thu, 18 May 2006 19:47:47 +0200 From: Simon Olofsson User-Agent: Thunderbird 1.5.0.2 (X11/20060425) MIME-Version: 1.0 To: Kyrre Nygard , freebsd-questions@freebsd.org References: <7.0.1.0.2.20060518123424.02289418@broadpark.no> In-Reply-To: <7.0.1.0.2.20060518123424.02289418@broadpark.no> X-Enigmail-Version: 0.94.0.0 OpenPGP: id=3D001BE0; url=http://olofsson.de/simon/keys/simon_olofsson.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Cc: Subject: Re: Shell script cannot run on FAT32 partition X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2006 17:47:51 -0000 -----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-----