You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Shawn Wilson <sh...@atmreports.com> on 2002/10/14 17:41:09 UTC

File-related tasks, AND recursive unzip operation

I have struggled with this problem for a while now and I believe that it 
is just not possible, but maybe someone on this list has a different idea.

Basically, what I'd like to do is recurse into a directory tree which 
contains some ZIP files, and for each ZIP file expand it out into the 
directory it is found in. Using the <unzip> task I can successfully 
extract all the ZIP files, but I can't seem to find a way to make the 
destination dynamic too. This extracts them into a single root directory:

         <unzip dest="${build.dir}">
             <fileset dir="${build.dir}" includes="**/sample.*.zip"/>
         </unzip>

What frustrates me most about Ant is that you have all these 
file-related tasks that can work with filesets (copy, unzip, jar, etc.), 
but there appears to be now generic file-related task. That is, I could 
save myself lots of work if there was simply a task that "for this 
fileset, do X, Y, and Z" where X, Y, and Z are some other Ant tasks.

Is it even possible to code such a task for Ant or does Ant's 
architecture prevent this?

Thanks,
-shawn

-- 
====================================
Shawn Wilson [shawnw@atmreports.com]
Software Developer, ATMReports.com
PH: 877-327-0873, FAX: 406-294-5806
====================================


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: File-related tasks, AND recursive unzip operation

Posted by Ken Wood <kw...@i2.com>.
Well, here is an alternative....

Is the location of the zips pretty much fixed? If so,
you could have a top level build.xml that unzips
a zip in it's directory, and then invokes a build.xml
using <ant antfile=....../> which unzips files lower
down, and then invokes even lower build.xml files to
unzip farther down, etc. But if the location is dynamic
and you want to find these zips on the fly, well, my
suggession won't work...

Shawn Wilson wrote:
> 
> Hi, I didn't get any replies on this. Does nobody have a solution?
> 
> Thanks,
> -shawn
> 
> Shawn Wilson wrote:
> > I have struggled with this problem for a while now and I believe that it
> > is just not possible, but maybe someone on this list has a different idea.
> >
> > Basically, what I'd like to do is recurse into a directory tree which
> > contains some ZIP files, and for each ZIP file expand it out into the
> > directory it is found in. Using the <unzip> task I can successfully
> > extract all the ZIP files, but I can't seem to find a way to make the
> > destination dynamic too. This extracts them into a single root directory:
> >
> >         <unzip dest="${build.dir}">
> >             <fileset dir="${build.dir}" includes="**/sample.*.zip"/>
> >         </unzip>
> >
> > What frustrates me most about Ant is that you have all these
> > file-related tasks that can work with filesets (copy, unzip, jar, etc.),
> > but there appears to be now generic file-related task. That is, I could
> > save myself lots of work if there was simply a task that "for this
> > fileset, do X, Y, and Z" where X, Y, and Z are some other Ant tasks.
> >
> > Is it even possible to code such a task for Ant or does Ant's
> > architecture prevent this?
> >
> > Thanks,
> > -shawn
> >
> 
> --
> ====================================
> Shawn Wilson [shawnw@atmreports.com]
> Software Developer, ATMReports.com
> PH: 877-327-0873, FAX: 406-294-5806
> ====================================
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: File-related tasks, AND recursive unzip operation

Posted by Shawn Wilson <sh...@atmreports.com>.
Hi, I didn't get any replies on this. Does nobody have a solution?

Thanks,
-shawn

Shawn Wilson wrote:
> I have struggled with this problem for a while now and I believe that it 
> is just not possible, but maybe someone on this list has a different idea.
> 
> Basically, what I'd like to do is recurse into a directory tree which 
> contains some ZIP files, and for each ZIP file expand it out into the 
> directory it is found in. Using the <unzip> task I can successfully 
> extract all the ZIP files, but I can't seem to find a way to make the 
> destination dynamic too. This extracts them into a single root directory:
> 
>         <unzip dest="${build.dir}">
>             <fileset dir="${build.dir}" includes="**/sample.*.zip"/>
>         </unzip>
> 
> What frustrates me most about Ant is that you have all these 
> file-related tasks that can work with filesets (copy, unzip, jar, etc.), 
> but there appears to be now generic file-related task. That is, I could 
> save myself lots of work if there was simply a task that "for this 
> fileset, do X, Y, and Z" where X, Y, and Z are some other Ant tasks.
> 
> Is it even possible to code such a task for Ant or does Ant's 
> architecture prevent this?
> 
> Thanks,
> -shawn
> 

-- 
====================================
Shawn Wilson [shawnw@atmreports.com]
Software Developer, ATMReports.com
PH: 877-327-0873, FAX: 406-294-5806
====================================


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: File-related tasks, AND recursive unzip operation

Posted by Shawn Wilson <sh...@atmreports.com>.
Okay thanks. I've seen some references to <foreach> on this list and I 
think that may just be what I need. For my uses, I will not need to 
unzip any zip files that may be within the zip files I use, to I won't 
run into the recursion problem.

Thanks again,
-shawn

Matt Benson wrote:
> Seems like it would be easy using...
> 
> can anyone guess what I am going to say?
> 
> <foreach>!!! yay!!!
> 
> The only difficulty is that unzipping these archives
> might yield more directories with archives to be
> unzipped, so that the dirset on which you would want
> to operate might be dynamic.  In that case I would use
> recursive <foreach> tasks; however you might run into
> memory problems with this approach.  If this happens I
> would next suggest trying the modified <foreach> task
> provided (I believe) by Geoff Meakin.  You can find
> references to it by searching this list.
> 
> -Matt
> 
> --- Shawn Wilson <sh...@atmreports.com> wrote:
> 
>>Hi, I didn't get any replies on this. Does nobody
>>have a solution?
>>
>>Thanks,
>>-shawn
>>
>>Shawn Wilson wrote:
>>
>>>I have struggled with this problem for a while now
>>
>>and I believe that it 
>>
>>>is just not possible, but maybe someone on this
>>
>>list has a different idea.
>>
>>>Basically, what I'd like to do is recurse into a
>>
>>directory tree which 
>>
>>>contains some ZIP files, and for each ZIP file
>>
>>expand it out into the 
>>
>>>directory it is found in. Using the <unzip> task I
>>
>>can successfully 
>>
>>>extract all the ZIP files, but I can't seem to
>>
>>find a way to make the 
>>
>>>destination dynamic too. This extracts them into a
>>
>>single root directory:
>>
>>>        <unzip dest="${build.dir}">
>>>            <fileset dir="${build.dir}"
>>
>>includes="**/sample.*.zip"/>
>>
>>>        </unzip>
>>>
>>>What frustrates me most about Ant is that you have
>>
>>all these 
>>
>>>file-related tasks that can work with filesets
>>
>>(copy, unzip, jar, etc.), 
>>
>>>but there appears to be now generic file-related
>>
>>task. That is, I could 
>>
>>>save myself lots of work if there was simply a
>>
>>task that "for this 
>>
>>>fileset, do X, Y, and Z" where X, Y, and Z are
>>
>>some other Ant tasks.
>>
>>>Is it even possible to code such a task for Ant or
>>
>>does Ant's 
>>
>>>architecture prevent this?
>>>
>>>Thanks,
>>>-shawn
>>>
>>
>>-- 
>>====================================
>>Shawn Wilson [shawnw@atmreports.com]
>>Software Developer, ATMReports.com
>>PH: 877-327-0873, FAX: 406-294-5806
>>====================================
>>
>>
>>--
>>To unsubscribe, e-mail:  
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail:
>><ma...@jakarta.apache.org>
>>
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Faith Hill - Exclusive Performances, Videos & More
> http://faith.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 
====================================
Shawn Wilson [shawnw@atmreports.com]
Software Developer, ATMReports.com
PH: 877-327-0873, FAX: 406-294-5806
====================================


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: File-related tasks, AND recursive unzip operation

Posted by Matt Benson <gu...@yahoo.com>.
Seems like it would be easy using...

can anyone guess what I am going to say?

<foreach>!!! yay!!!

The only difficulty is that unzipping these archives
might yield more directories with archives to be
unzipped, so that the dirset on which you would want
to operate might be dynamic.  In that case I would use
recursive <foreach> tasks; however you might run into
memory problems with this approach.  If this happens I
would next suggest trying the modified <foreach> task
provided (I believe) by Geoff Meakin.  You can find
references to it by searching this list.

-Matt

--- Shawn Wilson <sh...@atmreports.com> wrote:
> Hi, I didn't get any replies on this. Does nobody
> have a solution?
> 
> Thanks,
> -shawn
> 
> Shawn Wilson wrote:
> > I have struggled with this problem for a while now
> and I believe that it 
> > is just not possible, but maybe someone on this
> list has a different idea.
> > 
> > Basically, what I'd like to do is recurse into a
> directory tree which 
> > contains some ZIP files, and for each ZIP file
> expand it out into the 
> > directory it is found in. Using the <unzip> task I
> can successfully 
> > extract all the ZIP files, but I can't seem to
> find a way to make the 
> > destination dynamic too. This extracts them into a
> single root directory:
> > 
> >         <unzip dest="${build.dir}">
> >             <fileset dir="${build.dir}"
> includes="**/sample.*.zip"/>
> >         </unzip>
> > 
> > What frustrates me most about Ant is that you have
> all these 
> > file-related tasks that can work with filesets
> (copy, unzip, jar, etc.), 
> > but there appears to be now generic file-related
> task. That is, I could 
> > save myself lots of work if there was simply a
> task that "for this 
> > fileset, do X, Y, and Z" where X, Y, and Z are
> some other Ant tasks.
> > 
> > Is it even possible to code such a task for Ant or
> does Ant's 
> > architecture prevent this?
> > 
> > Thanks,
> > -shawn
> > 
> 
> -- 
> ====================================
> Shawn Wilson [shawnw@atmreports.com]
> Software Developer, ATMReports.com
> PH: 877-327-0873, FAX: 406-294-5806
> ====================================
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: File-related tasks, AND recursive unzip operation

Posted by Shawn Wilson <sh...@atmreports.com>.
Hi, I didn't get any replies on this. Does nobody have a solution?

Thanks,
-shawn

Shawn Wilson wrote:
> I have struggled with this problem for a while now and I believe that it 
> is just not possible, but maybe someone on this list has a different idea.
> 
> Basically, what I'd like to do is recurse into a directory tree which 
> contains some ZIP files, and for each ZIP file expand it out into the 
> directory it is found in. Using the <unzip> task I can successfully 
> extract all the ZIP files, but I can't seem to find a way to make the 
> destination dynamic too. This extracts them into a single root directory:
> 
>         <unzip dest="${build.dir}">
>             <fileset dir="${build.dir}" includes="**/sample.*.zip"/>
>         </unzip>
> 
> What frustrates me most about Ant is that you have all these 
> file-related tasks that can work with filesets (copy, unzip, jar, etc.), 
> but there appears to be now generic file-related task. That is, I could 
> save myself lots of work if there was simply a task that "for this 
> fileset, do X, Y, and Z" where X, Y, and Z are some other Ant tasks.
> 
> Is it even possible to code such a task for Ant or does Ant's 
> architecture prevent this?
> 
> Thanks,
> -shawn
> 

-- 
====================================
Shawn Wilson [shawnw@atmreports.com]
Software Developer, ATMReports.com
PH: 877-327-0873, FAX: 406-294-5806
====================================


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>