DOS命令将子目录中的所有文件向上移动一级
我有一个包含许多子文件夹的文件夹,每个子文件夹中都有一个或多个文件。我正在尝试编写一个批处理文件,将所有这些文件移动到 C:\songs (例如)。有什么帮助吗?我已经尝试过
C:\>FOR /R C:\Test %i IN (*) DO MOVE %i C:\Songs
文件夹 Test 和歌曲存在,但我收到一条错误消息,说
%i was unexpected at this time.
我做错了什么?
I have a folder with a lot of sub folders with one or more files in each. I am trying to write a batch file that moves all those files to C:\songs (for example). Any help? I have already tried
C:\>FOR /R C:\Test %i IN (*) DO MOVE %i C:\Songs
The folders Test and songs exist, but I get an error saying
%i was unexpected at this time.
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在批处理文件中,它必须是 %%i。批次的奇怪怪癖。
In a batch file, it has to be %%i. Weird quirk of batch.
(将子目录中的文件向上移动1)
(最后一部分我通常使用向后倾斜,但这个疯狂的东西由于某种原因不断删除它们。不管怎样它都会工作)
(删除不需要的目录)
即,如果你有一堆其下的“bin”目录中包含文件的目录
您想将所有内容向上移动 1 并删除“bin”目录。
(move files in sub-directories up 1)
(last part I usually use backward slants but this crazy thing kept deleting them for some reason. It'll work either way though)
(delete unneeded directories)
i.e., if you had a bunch of directories with files in "bin" directories under those
and you wanted to move everything up 1 and delete the "bin" directories.