0

FYI, I'm a complete newbie with Perl, as in I can spell it and only a little more so I'm trying to learn. What I'm trying to accomplish is using SFTP to transfer files from a Windows machine to a Linux machine.

I've noticed that Perl issues the SFTP get command, but doesn't wait for the transfer to finish so when the Perl script tries to use a file it can't find it. I know there is the sleep command, but the number and size of files will vary on a weekly basis so using sleep(600) seems a little silly.

Is there a standard way to pause a Perl script until SFTP finishes transferring all necessary files?

TIA.

4

1 回答 1

0

使用 Net::SFTP 可能已经解决了这个难题,但我的工作场所不允许我下载和安装东西,尤其是在生产环境中。因此,我没有等待典型的官僚机构,而是进行了更多挖掘并发现了这一点:

通过使用包含 SFTP 命令的单独文件以批处理模式调用 SFTP,Perl 脚本必须等待 SFTP 完成执行单独“命令”文件中的命令。因此,通过使用批处理模式选项,只要 SFTP 完成文件传输工作,Perl 脚本就会暂停。

于 2013-03-21T15:35:55.960 回答