[英]Create new subfolder with same name and move files to the new folder
I need your help to complete a windows batch (.cmd) file to create a new folder based on parent folder name and move some files to the new folder. 我需要您的帮助来完成Windows批处理(.cmd)文件,以基于父文件夹名称创建一个新文件夹,并将一些文件移到新文件夹中。
(both directory names and/or file names will be always different and may have space chars or dots) (目录名和/或文件名将始终不同,并且可能带有空格字符或点)
I managed to created the folder based on current dir name but I cant figure how to move the files to the new folder. 我设法根据当前目录名创建了该文件夹,但是我无法确定如何将文件移动到新文件夹。 I'm using this in a button in Total Commander that's is working partially.
我在正在部分工作的Total Commander的按钮中使用此按钮。
I'm not programmer, only have a very basic knowledge of batch. 我不是程序员,只具有非常基本的批处理知识。 I was searching a lot of examples and trying but I could not find the way.
我正在搜索很多示例并尝试,但是找不到方法。 Thanks in advance.
提前致谢。
I Have this: 我有这个:
D:\Artist - Album\ <--- current start path
├──01-track1.wav
├──01-track1.flac
├──02-track2.wav
├──02-track2.flac
Running this line to successfully create subfolder based on parent name: "Artist - Album (FLAC)" 运行此行可成功基于父名称创建子文件夹:“ Artist-Album(FLAC)”
for %%* in (.) do md "%%~n* (FLAC)"
Results in: 结果是:
D:\Artist - Album\
├───\Artist - Album (FLAC)\ <--- new folder OK!
├─01-track1.wav
├─01-track1.flac
├─02-track2.wav
├─02-track2.flac
What I want is move the .flac files inside that new folder like this: 我想要的是将.flac文件移动到新文件夹中,如下所示:
D:\Artist - Album\
├───\Artist - Album (FLAC)\ ┐
│ ├─01-track1.flac ├ ?
│ └─02-track2.flac ┘
├─01-track1.wav
└─02-track2.wav
for %%a in (.) do md "%%~na (FLAC)"&move "*.flac" ".\%%~na (FLAC)\"
&
cascades commands. &
级联命令。
(untested) (另)
Please don't use symbols as metavariables - only alphas are documented (and presumably supported) and *
and many other symbols have a special meaning to batch. 请不要将符号用作元变量-仅记录(且大概支持)字母和
*
以及许多其他符号具有批处理的特殊含义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.