Avoid download of previously downloaded files using Java FTP -
i have desktop application downloads files on server.when new file added want download newer file.
well know 1 "new one" have create map/or other datastructure , put pair of name/metadata creationtime(or last modified time)which 1 suits best , when iterate on files see metadata
path file = ...; basicfileattributes attr = files.readattributes(file, basicfileattributes.class); attr.creationtime(); //or attr.lastmodifiedtime();
when compare these times 1 on server decide download 1 latest time.
either way have keep track of @ least name/time modified(or created) @ previous download , compare these.
if application on desktop not kind of service runs nonstop,find way persist data on system,serialization or embed database h2/hsqldb within it.use streams conncurent iteration/ parralelstream check these times , compare ,in case use java8
edit- metadata url, check question get last modified date of url
Comments
Post a Comment