使用 xcopy 复制固定数量的文件
我有一个大目录,其中有很多子目录和文件。出于测试目的,我需要创建具有精确目录结构的上述副本(也是空目录),但仅从每个子目录复制两个文件(无论是哪两个)。我该如何使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这不能直接使用 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