创建一个包含目录中文件名的数组
我正在尝试使用批处理脚本将一堆目录中的一个或两个特定文件(因此我不想/不能使用*)从一个目录复制到另一个目录。
基本上我想导航到“根目录”,并使用 dir /AD-H /B 从中列出所有子目录,然后我想 cd 进入每个这些目录和 xcopy /y 到我存储在变量中的目录中。
我尝试了在网上找到的一些示例,但是当我修改它们时,它们无法正确处理开关。
谢谢
I'm trying to copy one or two specific files from a bunch of directories (hence why I don't want to/can't use *) from one directory to another using a batch script.
Basically I want to navigate into a "root directory" and from that list all the sub-directories using dir /AD-H /B
then I want to cd
into each of those directories and xcopy /y
into a directory I have stored in a variable.
I've tried some examples I've found on the web, but when I've modified them they have not been able to handle the switches properly.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 PHP 的目录列表,递归地将其放入数组中,这里是一个示例,但是您需要修改它以满足您的需求
Look into PHP an list the directory recursively into an array, here is a Example but you would need to modify it to fit your needs
使用 PowerShell,您可以使用以下内容:
将 C:\ 替换为要复制的“根目录”,将“E:\Test\”替换为要复制到的“根目录”(或者要使用环境变量 DestX,请将“E:\Test\”与 $env:DestX。
With PowerShell, you can use something like:
Replace C:\ with the "Root Directory" to copy from and replace "E:\Test\" with the "Root Directory" to copy to (or to use an environmental variable DestX, replace "E:\Test\" with $env:DestX.