Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 8472 invoked from network); 10 Oct 2007 10:41:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Oct 2007 10:41:17 -0000 Received: (qmail 38015 invoked by uid 500); 10 Oct 2007 10:41:02 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 37169 invoked by uid 500); 10 Oct 2007 10:41:00 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 37158 invoked by uid 99); 10 Oct 2007 10:41:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Oct 2007 03:41:00 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Oct 2007 10:41:03 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IfYzZ-0003Ub-Un for user@ant.apache.org; Wed, 10 Oct 2007 03:40:41 -0700 Message-ID: <13133400.post@talk.nabble.com> Date: Wed, 10 Oct 2007 03:40:41 -0700 (PDT) From: Alx G To: user@ant.apache.org Subject: Re: how can I copy a directory of files to lower case equivalents? In-Reply-To: <47023B16.1010006@apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: glubbah@yahoo.co.uk References: <12996743.post@talk.nabble.com> <47023B16.1010006@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Steve Loughran wrote: > > Alx G wrote: >> Hi, >> >> Does anyone know if there's anything in Ant that can copy files from a >> directory to another directory but change all the file names to lower >> case? >> >> e.g. >> >> working/some_folder/etc/Blah.jpg => dist/some_folder/etc/blah.jpg >> ... >> etc. for a whole load of files in various directories. >> >> Perhaps there's something I can add to this? >> >> >> >> >> >> If there's nothing in Ant directly, I'm going to have to write a PHP >> script >> that does the renaming but I'd prefer not to create more scripts. >> >> Any help would be much appreciated. >> >> Many Thanks! >> > > The ant-approved way would be a with an appropriate mapper listed > as a nested element. This gives copy the mapping from input filenames to > output names, lets it do the copying and dependency management as > normal. You just provide the renaming logic . > > I dont see one, but I do see in the manual the example, > which (ant1.7+ only) would let you do what you want in a few lines > > > > > > self.addMappedName(source.toLowerCase()); > > > > If you are running on java6, javascript is built in -no need for extra > JARs to get scripting working. > > Case conversion does sound like a common use case...you could always > write the java mapper and provide it with tests as an ant enhancement > bugrep. > > -steve > > > Thanks a lot for all the suggestions. I've upgraded Ant to 1.7 as I like this scriptmapper solution because it seems the simplest and most elegant. I've been trying to get it working but so far no joy. This is what I have: ... self.addMappedName(source.toLowerCase()); ... But it currently does nothing at all. If I take out the scriptmapper task however it goes ahead and copies the 2000+ files (obviously not to lowercase names as I would like). My files are of the form, Archery_Aim.gif etc. and the uppercase characters can occur anywhere - I'm not sure if this is relevant but I thought I'd mention it. (I'm not bothered about directory names as they are all in lowercase anyway). -- View this message in context: http://www.nabble.com/how-can-I-copy-a-directory-of-files-to-lower-case-equivalents--tf4554266.html#a13133400 Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org