I have an automated job that pulls files that are uploaded to our servers via a client facing site using xcopy.
我有一个自动化的作业,它使用xcopy通过面向客户的站点提取上传到我们服务器的文件。
Is there any way to only pull files that are fully uploaded?
有没有办法只提取完全上传的文件?
I have thought about creating a second "inProcess" folder that will be used for uploading and then move those files once fully uploaded, but that still creates a window of time when the file is in transition to a "Done" folder...
我已经考虑过创建第二个“inProcess”文件夹,该文件夹将用于上传,然后在完全上传后移动这些文件,但是当文件转换到“完成”文件夹时仍会创建一个时间窗口...
Any thoughts?
2 个解决方案
#1
use the .filepart extension for temporary files.
使用.filepart扩展名来获取临时文件。
It's probably the most simple and clear way of doing this.
这可能是最简单明了的做法。
WinSCP does this.
WinSCP就是这样做的。
#2
You can upload an MD5 hash of the file and then upload the file and if the file uploaded doesn't match the MD5 then it's not finished (or if it takes to long, perhaps it didn't upload properly)
你可以上传文件的MD5哈希,然后上传文件,如果上传的文件与MD5不匹配,那么它就没有完成(或者如果需要很长时间,也许它没有正确上传)
MD5 is often used to check the integrity of a file by creating a hash that represents the file. If the file varies at all, it will almost always (as in, basically never for our purposes) generate a different MD5 hash. The only reason a file would not match it's previously uploaded MD5 hash is if it wasn't finished or the MD5/file was corrupted on upload.
MD5通常用于通过创建表示文件的哈希来检查文件的完整性。如果文件完全不同,它几乎总是(因为,基本上永远不会出于我们的目的)生成不同的MD5哈希。文件与以前上传的MD5哈希不匹配的唯一原因是它是否未完成或者MD5 /文件在上传时已损坏。
There is also this. but it's perl and from expert exchange (ick)
还有这个。但它是perl和来自专家交流(ick)
#1
use the .filepart extension for temporary files.
使用.filepart扩展名来获取临时文件。
It's probably the most simple and clear way of doing this.
这可能是最简单明了的做法。
WinSCP does this.
WinSCP就是这样做的。
#2
You can upload an MD5 hash of the file and then upload the file and if the file uploaded doesn't match the MD5 then it's not finished (or if it takes to long, perhaps it didn't upload properly)
你可以上传文件的MD5哈希,然后上传文件,如果上传的文件与MD5不匹配,那么它就没有完成(或者如果需要很长时间,也许它没有正确上传)
MD5 is often used to check the integrity of a file by creating a hash that represents the file. If the file varies at all, it will almost always (as in, basically never for our purposes) generate a different MD5 hash. The only reason a file would not match it's previously uploaded MD5 hash is if it wasn't finished or the MD5/file was corrupted on upload.
MD5通常用于通过创建表示文件的哈希来检查文件的完整性。如果文件完全不同,它几乎总是(因为,基本上永远不会出于我们的目的)生成不同的MD5哈希。文件与以前上传的MD5哈希不匹配的唯一原因是它是否未完成或者MD5 /文件在上传时已损坏。
There is also this. but it's perl and from expert exchange (ick)
还有这个。但它是perl和来自专家交流(ick)