I am an ETL developer and I deal with a lot of data that needs to be processed from one form to the other before it can be loaded into tables. Therefore, most of the scripts that I work with, at some point, have to move a file from one place to the other. We are a windows shop. I was wondering if there was a way to see how much time a move takes when I am using the move function in Perl. If I need to call a windows command through system that will give me this option, then I am ok to use that as well. Is there anything in Perl or windows command line that will tell me the progress of the file transfer?
我是一名ETL开发人员,我处理大量需要从一种形式处理到另一种形式的数据,然后才能将其加载到表中。因此,我使用的大多数脚本在某些时候都必须将文件从一个位置移动到另一个位置。我们是一家门店。我想知道在Perl中使用move函数时是否有办法看看移动需要多少时间。如果我需要通过系统调用windows命令给我这个选项,那么我也可以使用它。 Perl或Windows命令行中是否有任何内容可以告诉我文件传输的进度?
Thanks!
1 个解决方案
#1
You can use the Win32::FileOp package from cpan.
您可以使用cpan中的Win32 :: FileOp包。
Here's a relevant excerpt:
这是一个相关的摘录:
CopyConfirm
CopyConfirm ($FileName => $FileOrDirectoryName [, ...]) CopyConfirm (\@FileNames => $DirectoryName [, ...] ) CopyConfirm (\@FileNames => \@FileOrDirectoryNames [, ...])
Copies the specified files. In case of a collision, shows a confirmation dialog. Shows progress dialogs.
复制指定的文件。如果发生碰撞,则显示确认对话框。显示进度对话框。
Returns true if successful.
如果成功则返回true。
MoveConfirm
Moves the specified files. Parameters as CopyConfirm
移动指定的文件。参数为CopyConfirm
A command line alternative would be Term::ProgressBar, which is also a lot more flexible, but somewhat harder to set up. You would have to do something like: get the original file's size, then start the copy and poll the new file's size (from a child process) to give updates to the progress bar.
命令行替代方案是Term :: ProgressBar,它也更灵活,但设置起来有些困难。您必须执行以下操作:获取原始文件的大小,然后启动副本并轮询新文件的大小(从子进程)以更新进度条。
#1
You can use the Win32::FileOp package from cpan.
您可以使用cpan中的Win32 :: FileOp包。
Here's a relevant excerpt:
这是一个相关的摘录:
CopyConfirm
CopyConfirm ($FileName => $FileOrDirectoryName [, ...]) CopyConfirm (\@FileNames => $DirectoryName [, ...] ) CopyConfirm (\@FileNames => \@FileOrDirectoryNames [, ...])
Copies the specified files. In case of a collision, shows a confirmation dialog. Shows progress dialogs.
复制指定的文件。如果发生碰撞,则显示确认对话框。显示进度对话框。
Returns true if successful.
如果成功则返回true。
MoveConfirm
Moves the specified files. Parameters as CopyConfirm
移动指定的文件。参数为CopyConfirm
A command line alternative would be Term::ProgressBar, which is also a lot more flexible, but somewhat harder to set up. You would have to do something like: get the original file's size, then start the copy and poll the new file's size (from a child process) to give updates to the progress bar.
命令行替代方案是Term :: ProgressBar,它也更灵活,但设置起来有些困难。您必须执行以下操作:获取原始文件的大小,然后启动副本并轮询新文件的大小(从子进程)以更新进度条。