使用 xcopy 复制固定数量的文件

发布于 2024-09-30 08:34:24 字数 103 浏览 0 评论 0原文

我有一个大目录,其中有很多子目录和文件。出于测试目的,我需要创建具有精确目录结构的上述副本(也是空目录),但仅从每个子目录复制两个文件(无论是哪两个)。我该如何使用 xcopy 来做到这一点?

I have a large directory with lots of sub-directories and files in them. For testing purpose, I need to create a copy of the above with exact directory structure (empty dirs too) but copy only two files (does not matter which two) from each sub-directory. How can I do that using xcopy.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独享拥抱 2024-10-07 08:34:24

我认为这不能直接使用 xcopy
您将能够使用以下命令复制目录结构和无文件:

xcopy /e /t path/to/folder path/to/copied/location

也就是说,使用 C++ 做一些事情(i更喜欢 Qt 的 QDir 类)并且仅复制每个目录 2 个文件就很简单了

I do not think that this can be directly done with using JUST xcopy.
You would be able to copy the directory structure and NO files useing this command:

xcopy /e /t path/to/folder path/to/copied/location

That being said, doing something using C++ (i'd prefer Qt's QDir class) and copy only 2 files from each directory would be quite trivial

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文