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

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

问题描述

需要找到一种通过FTP将文件上传到我的服务器的方法。但只有那些已经被修改。
有一个简单的方法吗?
命令行首选ftp客户端或脚本。
谢谢,Jonas。

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天全站免登陆