我怎样才能从服务器下载新文件? [英] How do I only download new files from a server?

查看:127
本文介绍了我怎样才能从服务器下载新文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些CSV文件,我想每天从雅虎财经下载。我想我的应用程序读取文件的创建日期(在我的电脑,而不是服务器)。如果创建日期早于今天,那么应该下载新文件(因为它将有新的数据)。如果不是,那么不应该下载新的文件,相关性计算器(这基本上是我的应用程序),应该使用上次下载的文件的特定股票代码。

<我已经做了一些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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆