如何通过Perl代码监视FTP传输的进度? [英] How to monitor the progress of FTP transfer through perl code?
问题描述
我们已经编写了一个实用程序来使用Perl通过FTP服务自动化文件传输。我们想知道我们如何跟踪上传进度?
.org / perldoc / Net :: FTPrel =nofollow noreferrer> Net :: FTP 有一个 hash
方法,它将打印一个#
标记为每个块(用户可定义的大小)转移到用户指定的文件句柄。 您也可以启用这个进度指示器在构造函数中:
哈希
- 如果给出对a的引用文件句柄(例如,\ * STDERR
),每1024字节在该文件句柄上打印散列标记(#
)。这只需调用hash()
方法,以便为所有传输显示散列标记。当然,您可以随时调用hash()
。
我没有用过它,但听起来很有希望。
We have written an utility to automate file transfer through FTP service using Perl. We want to know how we can track the progress of upload?
Net::FTP has a hash
method which will print a #
mark for every chunk (of a user-definable size) transferred to a user-specified file handle.
You can also enable this progress indicator in the constructor:
Hash
- If given a reference to a file handle (e.g.,\*STDERR
), print hash marks (#
) on that filehandle every 1024 bytes. This simply invokes thehash()
method for you, so that hash marks are displayed for all transfers. You can, of course, callhash()
explicitly whenever you'd like.
I have not used it, but sounds promising.
这篇关于如何通过Perl代码监视FTP传输的进度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!