ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dangerop <nabbl...@hotmail.com>
Subject avoid ftp get if files are too old?
Date Fri, 08 Oct 2010 23:34:28 GMT

Hi,

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 "weekly.zip")
2. tstamp to set property cutoff, with pattern="MM/dd/yyyy hh:mm aa"
offset="-10" unit="day"
3. touch file="${dir.data}/cutoff-date" datetime="${cutoff}"/>
4. uptodate property="is.newer" srcfile="${dir.data}/cutoff-date"
targetfile="${dir.data}/weekly.zip"
5. antcall another target with the "if" attribute set to the is.newer
property.

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?

Thanks,
KaJun

-- 
View this message in context: http://ant.1045680.n5.nabble.com/avoid-ftp-get-if-files-are-too-old-tp3205466p3205466.html
Sent from the Ant - Users mailing list archive at Nabble.com.

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


Mime
View raw message