Trying to find a simple way to do upload only modified files through FTP

前端 未结 7 1687
野趣味
野趣味 2021-01-12 18:43

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 scr

7条回答
  •  心在旅途
    2021-01-12 19:12

    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.

提交回复
热议问题