ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Allan <>
Subject RE: How to detect missing files when copying from a list of files ?
Date Wed, 12 Feb 2003 01:37:49 GMT

Thanks for the reply.  Sorry if I wasn't clear before - here's an example of
what I want to do.  Say I have a file called files.lst in the root of my
build with the contents:


I want to have an Ant task that reads the contents of files.lst and copies
the files listed in it to another directory, say a staging directory.  So
after running the task, I'd now have


I want that task to fail if any either foo.jar or foo.xml is missing.  This
is a greatly simplified version; the real application might involve a
file.lst with hundreds of files explicitly listed.

You confirmed my observation that feeding a fileset to copy via the
includesfile element won't work.  Is there some other way to do this short
of <script> or exec'ing an external perl/shell script?


-- Steve

> -----Original Message-----
> From: Ciramella, EJ [] 
> Sent: Tuesday, February 11, 2003 2:01 PM
> To: 'Ant Users List'
> Subject: RE: How to detect missing files when copying from a 
> list of files ?
> Could I ask for a little more detail?  There may be other 
> ways around your
> problem.  
> What are you copying?  Build.dir could be many things...
> Take a closer look at FileSet - "includesfile the name of a 
> file; each line
> of this file is taken to be an include pattern. ".  This means the
> includesfile simply is a suggestion as to what patterns you 
> should include.
> If a file is missing, the copy isn't going to complain...
> -----Original Message-----
> From: Steve Allan []
> Sent: Tuesday, February 11, 2003 4:52 PM
> To: ''
> Subject: How to detect missing files when copying from a list 
> of files?
> I'm having a recurring problem which I haven't been able to solve
> in Ant. As an example, say I have a file manifest which contains 
> all the files I expect to have in my distribution. I copy that to a 
> staging directory with copy and fileset:
> <copy todir = "${stage.dir}">
>   <fileset dir = "${build.dir}" includesfile = "${file.lst}"/>
> </copy>
> The problem is that if there are files in ${file.lst} that are missing
> (perhaps never built), fileset throws them out and copy never knows
> anything about them. It seems like <filelist> would solve that
> problem, because it would pass all the file names to <copy>, and then
> <copy> would complain about the missing ones. But <copy> won't accept
> a filelist. I really need the task to fail if any file in ${file.lst}
> is not found in ${build.dir}. 
> Is there a cookbook solution to this problem?
> -- Steve __ 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message