You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Wayne Cannon <wc...@turinnetworks.com> on 2007/07/19 16:51:10 UTC

fileset date selector based on the date of a file

I would like to do the equivalent of a "find -newer reference_file ... | 
zip ... ", i.e., archiving all files newer than a reference_file.  I 
would like to archive only the files that have changed since the last 
major archive into a smaller, faster, "delta" archive; much like an 
incremental backup works.

The <date> selector in a <fileset> looks like the logical solution, but 
it appears to only use a date-time string and not a reference file to 
specify the date.

Is there a way to use the date-time of a reference file, instead of a 
string, for the <date> selector?
Is there a way to set a property with the date-time of a reference file 
so that the property can be passed to a <date> selector?
Is there another way to accomplish my goal, such as a way to use 
<depend> with a single reference file?

--Wayne


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


Re: fileset date selector based on the date of a file

Posted by Wayne Cannon <wc...@turinnetworks.com>.
After that sales pitch, I'll definitely investigate the Ant-Contrib 
"outofdate".  Thanks.

I'm also investigating whether a <depend> selector with a <mapper> 
element can do what I'm looking for.

--Wayne

Dominique Devienne wrote:
> My bad, I so seldom used uptodate after outofdate came out that I
> forgot how much inferior it is to outofdate ;-)
>
> Sounds like Matt's solution's the way to go for pure Ant 1.7+, while
> I'd probably use Ant-Contrib's <outofdate>  myself, 'cause I'm used to
> it, and can nest the tasks to perform directly in the <outofdate>.
> --DD
>
> On 7/19/07, Wayne Cannon <wc...@turinnetworks.com> wrote:
>> I don't understand how to use <uptodate> for this purpose.
>>
>> My reading of <uptodate> is that it will set a property if a file is
>> up-to-date with respect to another file (based on a merge mapper for my
>> case).  I currently use <uptodate> for determining whether certain
>> operations need to be performed (setting a boolean property), but only
>> at a very coarse level.  My requirement is to select (create a fileset
>> of) typically 10 to 50 files out of 4000 that have changed recently and
>> perform an operation with that fileset -- such as creating a zip archive
>> of all files that have changed since the last zip archive (my reference
>> file) was created.  Other tasks are running file-specific tests on only
>> those files that have changed (those in the "newer" fileset).
>>
>> Regards,
>> --Wayne
>>
>> Dominique Devienne wrote:
>> > You can use <uptodate> to select the newer files.
>> >
>> > Or Ant-Contrib's <outofdate>, which I find more convenient, since
>> > avoids having multiple targets, but it adds a dependency. --DD
>> >
>> > On 7/19/07, Wayne Cannon <wc...@turinnetworks.com> wrote:
>> >> I would like to do the equivalent of a "find -newer reference_file 
>> ... |
>> >> zip ... ", i.e., archiving all files newer than a reference_file.  I
>> >> would like to archive only the files that have changed since the last
>> >> major archive into a smaller, faster, "delta" archive; much like an
>> >> incremental backup works.
>> >>
>> >> The <date> selector in a <fileset> looks like the logical 
>> solution, but
>> >> it appears to only use a date-time string and not a reference file to
>> >> specify the date.
>> >>
>> >> Is there a way to use the date-time of a reference file, instead of a
>> >> string, for the <date> selector?
>> >> Is there a way to set a property with the date-time of a reference 
>> file
>> >> so that the property can be passed to a <date> selector?
>> >> Is there another way to accomplish my goal, such as a way to use
>> >> <depend> with a single reference file?
>> >>
>> >> --Wayne
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>> >
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>

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


Re: fileset date selector based on the date of a file

Posted by Dominique Devienne <dd...@gmail.com>.
My bad, I so seldom used uptodate after outofdate came out that I
forgot how much inferior it is to outofdate ;-)

Sounds like Matt's solution's the way to go for pure Ant 1.7+, while
I'd probably use Ant-Contrib's <outofdate>  myself, 'cause I'm used to
it, and can nest the tasks to perform directly in the <outofdate>.
--DD

On 7/19/07, Wayne Cannon <wc...@turinnetworks.com> wrote:
> I don't understand how to use <uptodate> for this purpose.
>
> My reading of <uptodate> is that it will set a property if a file is
> up-to-date with respect to another file (based on a merge mapper for my
> case).  I currently use <uptodate> for determining whether certain
> operations need to be performed (setting a boolean property), but only
> at a very coarse level.  My requirement is to select (create a fileset
> of) typically 10 to 50 files out of 4000 that have changed recently and
> perform an operation with that fileset -- such as creating a zip archive
> of all files that have changed since the last zip archive (my reference
> file) was created.  Other tasks are running file-specific tests on only
> those files that have changed (those in the "newer" fileset).
>
> Regards,
> --Wayne
>
> Dominique Devienne wrote:
> > You can use <uptodate> to select the newer files.
> >
> > Or Ant-Contrib's <outofdate>, which I find more convenient, since
> > avoids having multiple targets, but it adds a dependency. --DD
> >
> > On 7/19/07, Wayne Cannon <wc...@turinnetworks.com> wrote:
> >> I would like to do the equivalent of a "find -newer reference_file ... |
> >> zip ... ", i.e., archiving all files newer than a reference_file.  I
> >> would like to archive only the files that have changed since the last
> >> major archive into a smaller, faster, "delta" archive; much like an
> >> incremental backup works.
> >>
> >> The <date> selector in a <fileset> looks like the logical solution, but
> >> it appears to only use a date-time string and not a reference file to
> >> specify the date.
> >>
> >> Is there a way to use the date-time of a reference file, instead of a
> >> string, for the <date> selector?
> >> Is there a way to set a property with the date-time of a reference file
> >> so that the property can be passed to a <date> selector?
> >> Is there another way to accomplish my goal, such as a way to use
> >> <depend> with a single reference file?
> >>
> >> --Wayne
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
> >
>
> ---------------------------------------------------------------------
> 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: fileset date selector based on the date of a file

Posted by Wayne Cannon <wc...@turinnetworks.com>.
I don't understand how to use <uptodate> for this purpose.

My reading of <uptodate> is that it will set a property if a file is 
up-to-date with respect to another file (based on a merge mapper for my 
case).  I currently use <uptodate> for determining whether certain 
operations need to be performed (setting a boolean property), but only 
at a very coarse level.  My requirement is to select (create a fileset 
of) typically 10 to 50 files out of 4000 that have changed recently and 
perform an operation with that fileset -- such as creating a zip archive 
of all files that have changed since the last zip archive (my reference 
file) was created.  Other tasks are running file-specific tests on only 
those files that have changed (those in the "newer" fileset).

Regards,
--Wayne

Dominique Devienne wrote:
> You can use <uptodate> to select the newer files.
>
> Or Ant-Contrib's <outofdate>, which I find more convenient, since
> avoids having multiple targets, but it adds a dependency. --DD
>
> On 7/19/07, Wayne Cannon <wc...@turinnetworks.com> wrote:
>> I would like to do the equivalent of a "find -newer reference_file ... |
>> zip ... ", i.e., archiving all files newer than a reference_file.  I
>> would like to archive only the files that have changed since the last
>> major archive into a smaller, faster, "delta" archive; much like an
>> incremental backup works.
>>
>> The <date> selector in a <fileset> looks like the logical solution, but
>> it appears to only use a date-time string and not a reference file to
>> specify the date.
>>
>> Is there a way to use the date-time of a reference file, instead of a
>> string, for the <date> selector?
>> Is there a way to set a property with the date-time of a reference file
>> so that the property can be passed to a <date> selector?
>> Is there another way to accomplish my goal, such as a way to use
>> <depend> with a single reference file?
>>
>> --Wayne
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>

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


Re: fileset date selector based on the date of a file

Posted by Matt Benson <gu...@yahoo.com>.
Just for discussion's sake, this can also be solved
with some of the resource stuff introduced in Ant 1.7:

<restrict id="newer">
  <compare
xmlns="antlib:org.apache.tools.ant.types.resources.selectors"
when="gt">
    <control><file file="reference_file" /></control>
    <date
xmlns="antlib:org.apache.tools.ant.types.resources.comparators"
/>
  </compare>
  <fileset refid="candidate_files" />
</restrict>

... you should now have a resource collection at refid
"newer" consisting only of those members of
candidate_files that are newer than reference_file.

FWIW,
Matt

--- Dominique Devienne <dd...@gmail.com> wrote:

> You can use <uptodate> to select the newer files.
> 
> Or Ant-Contrib's <outofdate>, which I find more
> convenient, since
> avoids having multiple targets, but it adds a
> dependency. --DD
> 
> On 7/19/07, Wayne Cannon <wc...@turinnetworks.com>
> wrote:
> > I would like to do the equivalent of a "find
> -newer reference_file ... |
> > zip ... ", i.e., archiving all files newer than a
> reference_file.  I
> > would like to archive only the files that have
> changed since the last
> > major archive into a smaller, faster, "delta"
> archive; much like an
> > incremental backup works.
> >
> > The <date> selector in a <fileset> looks like the
> logical solution, but
> > it appears to only use a date-time string and not
> a reference file to
> > specify the date.
> >
> > Is there a way to use the date-time of a reference
> file, instead of a
> > string, for the <date> selector?
> > Is there a way to set a property with the
> date-time of a reference file
> > so that the property can be passed to a <date>
> selector?
> > Is there another way to accomplish my goal, such
> as a way to use
> > <depend> with a single reference file?
> >
> > --Wayne
> >
> >
> >
>
---------------------------------------------------------------------
> > 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
> 
> 



       
____________________________________________________________________________________
Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222

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


Re: fileset date selector based on the date of a file

Posted by Dominique Devienne <dd...@gmail.com>.
You can use <uptodate> to select the newer files.

Or Ant-Contrib's <outofdate>, which I find more convenient, since
avoids having multiple targets, but it adds a dependency. --DD

On 7/19/07, Wayne Cannon <wc...@turinnetworks.com> wrote:
> I would like to do the equivalent of a "find -newer reference_file ... |
> zip ... ", i.e., archiving all files newer than a reference_file.  I
> would like to archive only the files that have changed since the last
> major archive into a smaller, faster, "delta" archive; much like an
> incremental backup works.
>
> The <date> selector in a <fileset> looks like the logical solution, but
> it appears to only use a date-time string and not a reference file to
> specify the date.
>
> Is there a way to use the date-time of a reference file, instead of a
> string, for the <date> selector?
> Is there a way to set a property with the date-time of a reference file
> so that the property can be passed to a <date> selector?
> Is there another way to accomplish my goal, such as a way to use
> <depend> with a single reference file?
>
> --Wayne
>
>
> ---------------------------------------------------------------------
> 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: Invoking sql files in ANT.

Posted by Chun Ji <CJ...@pro-unlimited.com>.

-----Original Message-----
From: Priest, James (NIH/NIEHS) [C] [mailto:PriestJ@niehs.nih.gov]
Sent: Friday, July 20, 2007 4:50 AM
To: Ant Users List
Subject: RE: Invoking sql files in ANT.
Importance: Low


> -----Original Message-----
> From: Chun Ji [mailto:CJi@pro-unlimited.com] 

> I  was trying to call some sql files from ANT, and it keeps 
> giving me some "ORA-00922, ORA-00900.." errors. I don't think 

Charlie - I take it by the error messages you are using Oracle - check
out my wiki post here:

http://www.thecrumb.com/wiki/Oracle%2C_SQL%2APlus_and_Ant

I've been using the Incanto tasks to run Oracle scripts and it works
great.



Thanks Jim, 
I made it work in either "incanto" way, or I just "exe" the sqlplus in my build.xml file. 


Regards, 



Charlie. 







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


RE: Invoking sql files in ANT.

Posted by "Priest, James (NIH/NIEHS) [C]" <Pr...@niehs.nih.gov>.
> -----Original Message-----
> From: Chun Ji [mailto:CJi@pro-unlimited.com] 

> I  was trying to call some sql files from ANT, and it keeps 
> giving me some "ORA-00922, ORA-00900.." errors. I don't think 

Charlie - I take it by the error messages you are using Oracle - check
out my wiki post here:

http://www.thecrumb.com/wiki/Oracle%2C_SQL%2APlus_and_Ant

I've been using the Incanto tasks to run Oracle scripts and it works
great.

Jim 

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


Invoking sql files in ANT.

Posted by Chun Ji <CJ...@pro-unlimited.com>.
Hi all, 
I  was trying to call some sql files from ANT, and it keeps giving me some "ORA-00922, ORA-00900.." errors. I don't think there is anything special in the ant/build.xml, but is because something in the sql file that ANT/SQL can not recognize, such as:  
" 
set define off
...

spool exe_migration.sql
...

spool off

spool exe_migration.lst
@exe_migration.sql
spool off

". But on the other hand, the above sql runs errorless by using SQLPLUS. 

So I am just wondering what is the limitation when sql files are invoked by ANT? And if there is a way I can make the above sql working in ANT?  
 

thanks. 


Charlie
(The jdbc library I am using is: ojdbc14.jar, and ANT version is 1.7.0.  Everything is running on Linux box ) 



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


Re: fileset date selector based on the date of a file

Posted by Wayne Cannon <wc...@turinnetworks.com>.
May I respectfully suggest a <file> attribute alternative to the <date> 
selector's current <datetime> and <millis> attributes?

--Wayne

Wayne Cannon wrote:
> I would like to do the equivalent of a "find -newer reference_file ... 
> | zip ... ", i.e., archiving all files newer than a reference_file.  I 
> would like to archive only the files that have changed since the last 
> major archive into a smaller, faster, "delta" archive; much like an 
> incremental backup works.
>
> The <date> selector in a <fileset> looks like the logical solution, 
> but it appears to only use a date-time string and not a reference file 
> to specify the date.
>
> Is there a way to use the date-time of a reference file, instead of a 
> string, for the <date> selector?
> Is there a way to set a property with the date-time of a reference 
> file so that the property can be passed to a <date> selector?
> Is there another way to accomplish my goal, such as a way to use 
> <depend> with a single reference file?
>
> --Wayne
>
>
> ---------------------------------------------------------------------
> 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