复制文件 [英] copying files
本文介绍了复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想将d:中的一个目录中的一些文件复制到c:中的另一个目录,我尝试使用xcopy但它说的参数太多了!!请给出建议
我想知道的另一件事是我如何从perl调用命令提示符?
Hi All,
I want to copy some files from one dir in d:, to another dir in c:, i tried using xcopy but it says too many parameters!!pls give suggestions
another thing i wanted to know is how can i invoke command prompt from perl??
推荐答案
好的,首先,当你发布一个问题,总是建议你发布你迄今为止尝试过的代码,这样我们就可以帮助你调整和学习。那就说了,你尝试了什么?
我不熟悉xcopy,但你总是可以查看名为文件::复制,可以复制文件。如果它是您要移动的目录而不仅仅是文件,那么您将需要阅读 File :: Copy :: Recursive 。
对于你想做的任何事情,只需搜索CPAN并查看什么是可用的。
至于你的调用命令行问题,我不确定你在问什么。如果它想要从Perl脚本运行系统级命令那么简单,那么只需将命令及其选项包含在后面的标记中:
Ok, first, when you post a question, it is always recommended that you post the code that you have tried thus far so we can help you tweak it and learn. That said, what have you tried?
I am not versed in xcopy, but you could always check out the module called File::Copy, which will enable you to copy files. If it is directories that you are looking to move and not just files, then you will want to read up on File::Copy::Recursive.
For anything you want to do, just search CPAN and see what is available.
As for your "invoking the command line" question, I am not exactly sure what you are asking. If it is as simple as wanting to run a system level command from a Perl script, then just enclose the command and its options in back ticks:
展开 | 选择 | Wrap | 行号
如果在Windows上:
c:\> xcopy /?
>
if on windows:
c:\>xcopy /?
展开 | S选举 | Wrap | 行号
我试过的代码,并使用了你曾建议的file :: copy模块
Hi,
following piece of code i tried,and used file::copy module which u had suggested
展开 | 选择 | Wrap < span class =codeDivider> | 行号
这篇关于复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文