我怎样才能从服务器下载新文件? [英] How do I only download new files from a server?
问题描述
<我已经做了一些Google搜索,并找到了Apache POI项目。
这是最好的方式,有没有更好的方法,你会推荐什么。是否JNI在这里是相关的?
您是否考虑创建一个FTP帐户访问该特定的文件夹,然后使用FTP客户端如SmartFTP或FileZilla同步您的本地文件夹与远程?应该很容易设置,也方便使用...此外,您可以简单地创建一个FTP命令脚本,并从您的Java代码执行,如果绝对必要的话... ... $ / b
$ b
或者我会试着将您指向另一个方向:md5()或其他消息摘要算法可以帮助您。你不必依靠时间戳。尝试计算你所拥有的文件和即将下载的文件的md5()散列。那么你知道是否要下载。
I have a number of CSV files that I want to download from Yahoo finance each day. I want my application to read the file's creation date (on my computer, not the server). If the creation date is prior to today then the new file should be downloaded (as it will have new data). If not then the new file should not be downloaded, and the correlation calculator (which is essentially what my application is), should use the last downloaded file for the particular stock code.
I have done some googling and have found the Apache POI project.
Is this the best way to go, is there a better way, what would you recommend. Is JNI at all relevant here?
Did you consider creating an FTP account for access to that particular folder and then using an FTP client like SmartFTP or FileZilla to synchronize your local folder with the remote one? Should be well easy to set up and also convenient to use... Also, you could simply create an FTP command script and execute that from your Java code, if absolutely necessary...
Or I'll try to point you into another direction: md5() or other message-digest algorithms could help you. you wouldn't have to rely on timestamps. Try to calculate md5() hash of the file you have and the file you are about to download. Then you know whether to download or not.
这篇关于我怎样才能从服务器下载新文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!