如何确定文件是否仍然通过ftp传输 [英] How to determine whether a file is still being transferred via ftp

查看:105
本文介绍了如何确定文件是否仍然通过ftp传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要使用PHP批处理文件的目录。这些文件通过FTP复制到服务器上。有些文件非常大,需要很长时间进行复制。如何在PHP中确定文件是否仍在传输(所以我可以跳过对该文件的处理并在批处理的下一次运行中处理它)?



一种可能性是获取文件大小,稍等片刻,并验证文件大小是否不同。这是不防水的,因为有一个小小的机会,转移只是暂时停顿了一会儿...

我们的服务器admin建议使用ftpwho,它输出当前正在传输的文件。

http://www.castaglia.org/proftpd/doc/ftpwho.html



所以解决方法是解析输出的ftpwho来查看目录中的文件是否正在传输。


I have a directory with files that need processing in a batch with PHP. The files are copied on the server via FTP. Some of the files are very big and take a long time to copy. How can I determine in PHP if a file is still being transferred (so I can skip the processing on that file and process it in the next run of the batch process)?

A possibility is to get the file size, wait a few moments, and verify if the file size is different. This is not waterproof because there is a slight chance that the transfer was simply stalled for a few moments...

解决方案

Our server admin suggested ftpwho, which outputs which files are currently transferred.

http://www.castaglia.org/proftpd/doc/ftpwho.html

So the solution is to parse the output of ftpwho to see if a file in the directory is being transferred.

这篇关于如何确定文件是否仍然通过ftp传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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