How to determine whether a file is still being transferred via ftp(如何确定文件是否仍在通过 ftp 传输)
问题描述
我有一个目录,其中包含需要使用 PHP 批量处理的文件.文件通过 FTP 复制到服务器上.有些文件非常大,需要很长时间才能复制.如何在 PHP 中确定文件是否仍在传输中(以便我可以跳过对该文件的处理并在批处理的下一次运行中处理它)?
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...
推荐答案
我们的服务器管理员建议使用 ftpwho,它会输出当前传输的文件.
Our server admin suggested ftpwho, which outputs which files are currently transferred.
http://www.castaglia.org/proftpd/doc/ftpwho.html
所以解决的办法是解析ftpwho的输出,看目录中是否有文件正在传输.
So the solution is to parse the output of ftpwho to see if a file in the directory is being transferred.
这篇关于如何确定文件是否仍在通过 ftp 传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何确定文件是否仍在通过 ftp 传输


基础教程推荐
- Libpuzzle 索引数百万张图片? 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01