试图找到一种简单的方法来通过 FTP 只上传修改过的文件 [英] Trying to find a simple way to do upload only modified files through FTP

查看:19
本文介绍了试图找到一种简单的方法来通过 FTP 只上传修改过的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要找到一种通过 FTP 将文件上传到我的服务器的方法.但只有那些已经修改过的.有没有一种简单的方法可以做到这一点?命令行 ftp 客户端或脚本是首选.谢谢,乔纳斯.

Need to find a way to upload files to my server through FTP. But only the ones that have been modified. Is there a simple way of doing that? Command line ftp client or script is preferred. Thanks, Jonas.

推荐答案

最可靠的方法是对您关心的所有本地文件进行 md5 哈希并将其存储在一个文件中.因此该文件将包含文件名列表及其 md5 哈希值.将该文件存储在您的 ftp 服务器上.当您想更新 ftp 服务器上的文件时,请下载包含该列表的文件,将其与您的所有本地文件进行比较,然后上传已更改(或新的)的文件.这样一来,您就不必担心存档位、修改日期或查看文件大小,因为这些文件的使用永远不会 100% 可靠.

The most reliable way would be to make md5 hashes of all the local files you care about and store it in a file. So the file will contain a list of filenames and their md5 hashes. Store that file on your ftp server. When you want to update the files on your ftp server, download the file containing the list, compare that against all your local files, and upload the files that have changed (or are new). That way you don't have to worry about archive bits, modified date, or looking at file sizes, the use of which can never be 100% reliable.

使用文件大小并不可靠,原因很明显 - 文件可以更改但大小相同.我不喜欢使用存档位或修改日期,因为如果您使用另一个备份程序备份或恢复本地目录,这两者都可能会混淆.

Using file sizes isn't reliable for the obvious reason - a file could change but have the same size. I'm not a fan of using the archive bit or modified date because either of those could be confused if you backup or restore your local directory with another backup program.

这篇关于试图找到一种简单的方法来通过 FTP 只上传修改过的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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