ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: avoid ftp get if files are too old?
Date Mon, 25 Oct 2010 13:17:37 GMT

This will upload only the 'modified' files (independ of the date).


>-----Urspr√ľngliche Nachricht-----
>Von: dangerop [] 
>Gesendet: Samstag, 9. Oktober 2010 01:34
>Betreff: avoid ftp get if files are too old?
>I've got a situation where we run a weekly process to download 
>files off an
>ftp site once a week.  I've got an Ant build file which will 
>connect to the
>server and download the files, but I'd like to avoid 
>downloading them if the
>files are from the previous week.  I was thinking of getting the file
>timestamp and comparing it to e.g. (now - 10 days) but I 
>haven't had much
>luck finding this in the documentation.
>The closest I've gotten is this, which downloads the files, 
>uses tstamp to
>set a datestamp offset from today, touches a file with that 
>datestamp, then
>uses uptodate to see if the file from the ftp site is newer:
>1. ftp action="get" preservelastmodified="true" (file would be 
>2. tstamp to set property cutoff, with pattern="MM/dd/yyyy hh:mm aa"
>offset="-10" unit="day"
>3. touch file="${}/cutoff-date" datetime="${cutoff}"/>
>4. uptodate property="is.newer" srcfile="${}/cutoff-date"
>5. antcall another target with the "if" attribute set to the is.newer
>This works, but one of the files is several gigabytes large 
>and so I'd like
>to be able to just check the timestamps before transferring 
>it.  Any ideas?
>View this message in context: 
>Sent from the Ant - Users mailing list archive at
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message