Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 56574 invoked from network); 15 Dec 2010 20:18:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Dec 2010 20:18:07 -0000 Received: (qmail 78158 invoked by uid 500); 15 Dec 2010 20:18:06 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 78119 invoked by uid 500); 15 Dec 2010 20:18:06 -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 78111 invoked by uid 99); 15 Dec 2010 20:18:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Dec 2010 20:18:06 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of troendle@ca.ibm.com designates 32.97.182.143 as permitted sender) Received: from [32.97.182.143] (HELO e3.ny.us.ibm.com) (32.97.182.143) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Dec 2010 20:17:55 +0000 Received: from d01dlp01.pok.ibm.com (d01dlp01.pok.ibm.com [9.56.224.56]) by e3.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id oBFJxGcu029868 for ; Wed, 15 Dec 2010 14:59:24 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 05C62728674 for ; Wed, 15 Dec 2010 15:15:04 -0500 (EST) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oBFKF2fM311420 for ; Wed, 15 Dec 2010 15:15:03 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oBFKF2w5018731 for ; Wed, 15 Dec 2010 18:15:02 -0200 Received: from d01ml390.pok.ibm.com (d01ml390.pok.ibm.com [9.63.10.36]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id oBFKF1Tb018683 for ; Wed, 15 Dec 2010 18:15:02 -0200 In-Reply-To: <4D091314.60805@gmx.de> References: <4D07F30C.2040801@oopsconsultancy.com> <4D091314.60805@gmx.de> To: "Ant Users List" MIME-Version: 1.0 Subject: Re: Selectively delete files/folders on another server X-KeepSent: 080FF8F1:AA165C70-882577FA:006DFCC7; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.5.1FP1 SHF20 February 10, 2010 From: Maureen Troendle Message-ID: Date: Wed, 15 Dec 2010 12:15:00 -0800 X-MIMETrack: Serialize by Router on D01ML390/01/M/IBM(Release 8.0.2FP6|July 15, 2010) at 12/15/2010 15:15:01, Serialize complete at 12/15/2010 15:15:01 Content-Type: multipart/alternative; boundary="=_alternative 006ED71C882577FA_=" X-Content-Scanned: Fidelis XPS MAILER X-Virus-Checked: Checked by ClamAV on apache.org --=_alternative 006ED71C882577FA_= Content-Type: text/plain; charset="US-ASCII" The idea behind this is that there is one deployment server that deploys code to multiple envs with various middleware components (Oracle, Websphere, Message Broker, Business Objects) stored on multiple lpars. So I need to drop files, run scripts, deliver middleware components to 3 lpars for any given environment. We don't really want to install Ant on all systems, just the deployment server. We are already doing a lot of this type of work this way. I just need to learn how to read a file by line in Ant and get the output of that line so I can perform an action on it. criteria for deleting I have a set location with set folders that get created and deleted. The problem is other people could also drop information to that location that I want to cleanup. ie. mainfolder folder1 folder2 folder3 folder4 I want to delete folder3 and 4 at this location but leave folder1 and 2 (I know the names of the folders so the exclude decision is not an issue). I also want to delete anything else that someone drops there. ie. folder5 text.txt I am archiving the whole thing first so zip'ing mainfolder. Then cleaning up part of it and recreating part of it, but some of it needs to stay. ie. leaving an archive directory where the zips are stored. Leaving folder where part of app installed. Regards, Maureen Maureen Troendle IBM Canada phone: 250-220-1147 cell: 250-661-2145 fax: 250 220-1122 email: troendle@ca.ibm.com From: Antoine Levy-Lambert To: Ant Users List Date: 12/15/2010 11:14 AM Subject: Re: Selectively delete files/folders on another server Hello Maureen, would it be possible to install ant on the target machines and move the logic to determine folders to be deleted there ? this might be a way to do this work more simply. What is the criteria according to which you know which directories/files to delete or to preserve ? Regards, Antoine On 12/15/2010 12:30 PM, Maureen Troendle wrote: > I'm using Ant to deploy various components to different servers and I'm > looking for a way to enumerate files/folders on a remote server and then > selectively delete them. So I don't know everything that will be there > but I know the folders I want to leave undeleted. I'm looking for some > kind of foreach loop or something that will work for me. > I'm using Ant 1.7.0 on AIX 5.3 servers. > I'm looking for help on how to enumerate each line in a file. And then I > guess the best method would be to modify that file to remove the folders I > don't want to delete and use that to sshexec once and delete files/folders > rather than doing an sshexec for each line item. ie. sshexec across once > and delete all in a loop versus loop and sshexec for each item. > > I can echo what's in that remote location using this: > password="${targe > t.password}" failonerror="true" trust="true" > output="${deploy.temp.dir}/remote > list.txt" append="false" command=". $HOME/.profile; cd ${dc.fs}; ls" /> > > Now I'm trying to read remotelist.txt line by line and delete everything > excluding certain folders. I'm having trouble splitting the lines. > Here's a couple of things I've tried. > 1. > param="itemfound" target="rmitem" /> > > In target, rmitem, for now I'm just trying to echo the lines in > remotelist.txt but eventually I'll need to do an sshexec with an rm -rf > ${line}. > > 2. > property="item > found"> > > > > Error: foreach doesn't support the "item" attribute > > 3. > file="${deploy.temp.dir}/remotelist.txt"/> > > > > Error: loadfile doesn't support the "file" attribute > > 4. > > > > Error: loadfile doesn't support the nested "echo" element. > > 5. > property="line"/> > > Error: this echos all of items found in ls as 1 item, ${line} > > 6. > > > > > > > Error: echos 1 line multiple times - [echo] Read line: ${line} > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org --=_alternative 006ED71C882577FA_=--