windows Robocopy 是否有任何 API 包装器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/365278/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Are there any API wrapper of Robocopy?
提问by Dennis C
Robocopy is the best reliable and feature rich way to batch copy files on Windows. However, it is a command line tool.
Robocopy 是在 Windows 上批量复制文件的最可靠且功能丰富的方式。但是,它是一个命令行工具。
I am looking for a library/API that I could do the same in my program. I tried to use Process.Start(), but then I have to capture and to parse stdout for progress bar and no way to the overwrite behavior.
我正在寻找一个可以在我的程序中执行相同操作的库/API。我尝试使用 Process.Start(),但随后我必须捕获并解析进度条的标准输出,而无法覆盖行为。
For example, exclude file base on delegate function; rename file if it is older; (re)start copy based on some events.
例如,基于委托函数排除文件;如果文件较旧,请重命名文件;(重新)根据某些事件开始复制。
I guess copy, xcopy, recursive copy and etc, should be the most frequency wheel programmers do reinvent. Are there any API/library I missed?
我想复制、xcopy、递归复制等等,应该是最频繁的轮子程序员重新发明。有没有我错过的 API/库?
采纳答案by Dennis C
Thanks for your answers, and after some more research, I believe the API does not exist.
感谢您的回答,经过更多研究,我相信 API 不存在。
The maximum degree of reusing the feature from Robocopy is fork a child process with command line arguments.
重用 Robocopy 功能的最大程度是使用命令行参数 fork 子进程。
回答by tjscience
I realize that this is a very old post, but just in case someone stumbles upon it...
我意识到这是一个非常古老的帖子,但以防万一有人偶然发现它......
I wrote a wrapper for robocopy in c# called RoboSharp. It does exactly what the OP originally requested.
我在 C# 中为 robocopy 编写了一个名为 RoboSharp 的包装器。它完全符合 OP 最初的要求。
回答by bugmagnet
There seems to be some stuff out there which puts a GUI on it, e.g. Synchronizing Images and Files in Windows Vista and XP Using Microsoft SyncToy(forum here) and Utility Spotlight - Robocopy GUI. I haven't found an API as yet, nor whether Robocopy exposes ActiveX-style control.
似乎有一些东西在上面放置了 GUI,例如在 Windows Vista 和 XP 中使用 Microsoft SyncToy(此处为论坛)和Utility Spotlight-Robocopy GUI同步图像和文件。我还没有找到 API,也没有找到 Robocopy 是否公开 ActiveX 样式的控件。
Edit: The rather large online description of Robocopysays something about
编辑:Robocopy的相当大的在线描述说明了一些关于
Robocopy 'Jobs' and the 'MOnitor source' option provide an alternative to setting up a Scheduled Task to run a batchfile with a RoboCopy command.
Robocopy“作业”和“监控源”选项提供了设置计划任务以使用 RoboCopy 命令运行批处理文件的替代方法。
Might help. Might not.
可能有帮助。也许不会。