简体   繁体   English

用相同的名称创建新的子文件夹并将文件移动到新文件夹

[英]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.

相关问题 批处理文件以在文件夹中创建新的子文件夹,将文件移动到目录中所有文件夹的新创建的子文件夹 - batch file to create new subfolder in folder, move file to newly created subfolder, for all folders in directory Windows 7 Batch - 创建子文件夹,然后查找文件名中包含特定文本的文件并将这些文件移动到新创建的子文件夹中 - Windows 7 Batch - Create subfolder, then find files with certain text in file name and move those files in the newly created subfolder 程序将解锁的文件移动到新文件夹 - Program to move unlocked files to an new folder 根据名称批量移动文件到新的子文件夹 - Batch move files to new subfolders based on name 当已经存在同名文件夹时,如何使用boost创建新文件夹? - How to create a new folder using boost when a folder with the same name already exists? 根据部分文件名批量创建文件夹并将文件移动到文件夹 - Batch create folder based on partial file name and move files to folder 从文件夹中复制所有文件。 子文件夹进入新文件夹Win 10 - Copying all files from folder incl. subfolder into a new folder Win 10 批处理文件根据文件名创建目录,将类似文件移动到新目录 - batch file to create directory based on file name, move like files to new directory 按年份将文件夹(包括文件)移动到新的父文件夹 - Move Folders (including files) to new parent folder by year 批量创建基于部分文件名的文件夹并将文件移动到该文件夹​​中 - Batch create folders based on part of file name and move files into that folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM