You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Dick, Brian E." <Br...@fmr.com> on 2007/10/25 22:11:45 UTC

How do I filter a file of files

I have a file of files that I need to load into a property and filter
according to expressions similar to the "include" and "exclude" elements
of a patternset.

For example, assume I have a file, fof.dat, containing the following.

/export/home/myaccount/myapp/bin/pgm1
/export/home/myaccount/myapp/bin/pgm2
/export/home/myaccount/myapp/config/cfg1
/export/home/myaccount/myapp/lib/lib1.jar
/export/home/myaccount/myapp/lib/lib2.jar
/export/home/myaccount/myapp/lib/lib3.jar

I would like code something like the following.

<patternset id="bin_files">
   <include name="bin/*"/>
</patternset>

<loadfile property="bin_file_list" srcFile="fof.dat">
   <filterchain>
      <filefilter dir="/export/home/myaccount/myapp">
         <patternset refid="bin_files"/>
      </filefilter>
   </filterchain>
</loadfile>

After the loadfile task, the bin_file_list property would contain the
following.

/export/home/myaccount/myapp/bin/pgm1
/export/home/myaccount/myapp/bin/pgm2


RE: How do I filter a file of files

Posted by "Dick, Brian E." <Br...@FMR.com>.
Steve Loughran wrote:
> we always welcome improvements to the existing tasks; scp could do
with 
> directory creation, listing and dependency checking.
> 
> historically, the troublespot with scp has always been testing, but
now 
> that vmware is free for windows+unix, the cost of getting an scp
server 
> is the time, bandwidth and disk space to download and install a copy
of 
> xubuntu. Which implies we could start thinking about using antunit to 
> test the scp & ssh tasks
> 
> -steve

But nothing for now?

Is the file filter code used by tasks modularized in such a way that I
could use them in a script filter?

Later,
BEDick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: How do I filter a file of files

Posted by Steve Loughran <st...@apache.org>.
Dick, Brian E. wrote:
> Thanks for the suggestion, but the scp task does not provide the
> capabilities I need. The scp task does not support a "list" action and
> does not support filesets on the remote host.

we always welcome improvements to the existing tasks; scp could do with 
directory creation, listing and dependency checking.

historically, the troublespot with scp has always been testing, but now 
that vmware is free for windows+unix, the cost of getting an scp server 
is the time, bandwidth and disk space to download and install a copy of 
xubuntu. Which implies we could start thinking about using antunit to 
test the scp & ssh tasks

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: How do I filter a file of files

Posted by "Dick, Brian E." <Br...@FMR.com>.
Thanks for the suggestion, but the scp task does not provide the
capabilities I need. The scp task does not support a "list" action and
does not support filesets on the remote host.

-----Original Message-----
From: David Weintraub [mailto:qazwart@gmail.com] 
Sent: Wednesday, October 31, 2007 6:56 PM
To: Ant Users List
Subject: Re: How do I filter a file of files

One of the optional tasks in the <scp> task. This does a secure FTP as
an ant task. I understand that there is some problem with IBM systems,
but you'll have to look in the archive. See
<http://ant.apache.org/manual/OptionalTasks/scp.html>.

You will need jsch.jar 0.1.29 or later for <scp> to work.

On 10/31/07, Dick, Brian E. <Br...@fmr.com> wrote:
> Let me state my problem, rather than my idea of a solution. Maybe that
> will pique your interest.
>
> I have a macrodef in my current build that uses the ftp task to get a
> list of files from a remote server. The macrodef has attributes for
> specifying the remotedir and patternset for the ftp task. Something
like
> the following.
>
> <macrodef name="rls">
>    <attribute name="remotedir"/>
>    <attribute name="patternset"/>
>    <sequential>
>       <ftp action="list"
>        ...
>            remotedir="@{remotedir}"
>       >
>          <fileset dir=".">
>             <patternset refid="@{patternset}"/>
>          </fileset>
>       </ftp>
>    </sequential>
> </macrodef>
>
> Our company is implementing a policy to allow only secure shell access
> to our servers. I can't use the ftp task anymore. How can I achieve
this
> functionality using secure shell access within Ant?
>
> -----Original Message-----
> From: Dick, Brian E.
> Sent: Thursday, October 25, 2007 4:12 PM
> To: Ant Users List
> Subject: How do I filter a file of files
>
> I have a file of files that I need to load into a property and filter
> according to expressions similar to the "include" and "exclude"
elements
> of a patternset.
>
> For example, assume I have a file, fof.dat, containing the following.
>
> /export/home/myaccount/myapp/bin/pgm1
> /export/home/myaccount/myapp/bin/pgm2
> /export/home/myaccount/myapp/config/cfg1
> /export/home/myaccount/myapp/lib/lib1.jar
> /export/home/myaccount/myapp/lib/lib2.jar
> /export/home/myaccount/myapp/lib/lib3.jar
>
> I would like code something like the following.
>
> <patternset id="bin_files">
>    <include name="bin/*"/>
> </patternset>
>
> <loadfile property="bin_file_list" srcFile="fof.dat">
>    <filterchain>
>       <filefilter dir="/export/home/myaccount/myapp">
>          <patternset refid="bin_files"/>
>       </filefilter>
>    </filterchain>
> </loadfile>
>
> After the loadfile task, the bin_file_list property would contain the
> following.
>
> /export/home/myaccount/myapp/bin/pgm1
> /export/home/myaccount/myapp/bin/pgm2
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
--
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: How do I filter a file of files

Posted by David Weintraub <qa...@gmail.com>.
One of the optional tasks in the <scp> task. This does a secure FTP as
an ant task. I understand that there is some problem with IBM systems,
but you'll have to look in the archive. See
<http://ant.apache.org/manual/OptionalTasks/scp.html>.

You will need jsch.jar 0.1.29 or later for <scp> to work.

On 10/31/07, Dick, Brian E. <Br...@fmr.com> wrote:
> Let me state my problem, rather than my idea of a solution. Maybe that
> will pique your interest.
>
> I have a macrodef in my current build that uses the ftp task to get a
> list of files from a remote server. The macrodef has attributes for
> specifying the remotedir and patternset for the ftp task. Something like
> the following.
>
> <macrodef name="rls">
>    <attribute name="remotedir"/>
>    <attribute name="patternset"/>
>    <sequential>
>       <ftp action="list"
>        ...
>            remotedir="@{remotedir}"
>       >
>          <fileset dir=".">
>             <patternset refid="@{patternset}"/>
>          </fileset>
>       </ftp>
>    </sequential>
> </macrodef>
>
> Our company is implementing a policy to allow only secure shell access
> to our servers. I can't use the ftp task anymore. How can I achieve this
> functionality using secure shell access within Ant?
>
> -----Original Message-----
> From: Dick, Brian E.
> Sent: Thursday, October 25, 2007 4:12 PM
> To: Ant Users List
> Subject: How do I filter a file of files
>
> I have a file of files that I need to load into a property and filter
> according to expressions similar to the "include" and "exclude" elements
> of a patternset.
>
> For example, assume I have a file, fof.dat, containing the following.
>
> /export/home/myaccount/myapp/bin/pgm1
> /export/home/myaccount/myapp/bin/pgm2
> /export/home/myaccount/myapp/config/cfg1
> /export/home/myaccount/myapp/lib/lib1.jar
> /export/home/myaccount/myapp/lib/lib2.jar
> /export/home/myaccount/myapp/lib/lib3.jar
>
> I would like code something like the following.
>
> <patternset id="bin_files">
>    <include name="bin/*"/>
> </patternset>
>
> <loadfile property="bin_file_list" srcFile="fof.dat">
>    <filterchain>
>       <filefilter dir="/export/home/myaccount/myapp">
>          <patternset refid="bin_files"/>
>       </filefilter>
>    </filterchain>
> </loadfile>
>
> After the loadfile task, the bin_file_list property would contain the
> following.
>
> /export/home/myaccount/myapp/bin/pgm1
> /export/home/myaccount/myapp/bin/pgm2
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
--
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: How do I filter a file of files

Posted by "Dick, Brian E." <Br...@FMR.com>.
Let me state my problem, rather than my idea of a solution. Maybe that
will pique your interest.

I have a macrodef in my current build that uses the ftp task to get a
list of files from a remote server. The macrodef has attributes for
specifying the remotedir and patternset for the ftp task. Something like
the following.

<macrodef name="rls">
   <attribute name="remotedir"/>
   <attribute name="patternset"/>
   <sequential>
      <ftp action="list"
       ...
           remotedir="@{remotedir}"
      >
         <fileset dir=".">
            <patternset refid="@{patternset}"/>
         </fileset>
      </ftp>
   </sequential>
</macrodef>

Our company is implementing a policy to allow only secure shell access
to our servers. I can't use the ftp task anymore. How can I achieve this
functionality using secure shell access within Ant?

-----Original Message-----
From: Dick, Brian E. 
Sent: Thursday, October 25, 2007 4:12 PM
To: Ant Users List
Subject: How do I filter a file of files

I have a file of files that I need to load into a property and filter
according to expressions similar to the "include" and "exclude" elements
of a patternset.

For example, assume I have a file, fof.dat, containing the following.

/export/home/myaccount/myapp/bin/pgm1
/export/home/myaccount/myapp/bin/pgm2
/export/home/myaccount/myapp/config/cfg1
/export/home/myaccount/myapp/lib/lib1.jar
/export/home/myaccount/myapp/lib/lib2.jar
/export/home/myaccount/myapp/lib/lib3.jar

I would like code something like the following.

<patternset id="bin_files">
   <include name="bin/*"/>
</patternset>

<loadfile property="bin_file_list" srcFile="fof.dat">
   <filterchain>
      <filefilter dir="/export/home/myaccount/myapp">
         <patternset refid="bin_files"/>
      </filefilter>
   </filterchain>
</loadfile>

After the loadfile task, the bin_file_list property would contain the
following.

/export/home/myaccount/myapp/bin/pgm1
/export/home/myaccount/myapp/bin/pgm2



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org