[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] 批处理如何批量将文件名中具有相同前缀字符串的文件移动到以该字符串命名的文件夹里

本帖最后由 pcl_test 于 2016-7-7 20:01 编辑

例如
MM\Sound\WaveArchives\WARC_2_0.wav移动到MM\Sound\WaveArchives\WARC_2\
MM\Sound\WaveArchives\WARC_2_1.wav移动到MM\Sound\WaveArchives\WARC_2\
MM\Sound\WaveArchives\WARC_2_2.wav移动到MM\Sound\WaveArchives\WARC_2\

MM\Sound\WaveArchives\WARC_3_0.wav移动到MM\Sound\WaveArchives\WARC_3\
MM\Sound\WaveArchives\WARC_3_1.wav移动到MM\Sound\WaveArchives\WARC_3\
MM\Sound\WaveArchives\WARC_3_2.wav移动到MM\Sound\WaveArchives\WARC_3\

MM\Sound\WaveArchives\WARC_BGM_ALL_0.wav移动到MM\Sound\WaveArchives\WARC_BGM_ALL\
MM\Sound\WaveArchives\WARC_BGM_ALL_1.wav移动到MM\Sound\WaveArchives\WARC_BGM_ALL\
MM\Sound\WaveArchives\WARC_BGM_ALL_2.wav移动到MM\Sound\WaveArchives\WARC_BGM_ALL\

MM\Sound\WaveArchives\WARC_SE_0.wav移动到MM\Sound\WaveArchives\WARC_SE
MM\Sound\WaveArchives\WARC_SE_1.wav移动到MM\Sound\WaveArchives\WARC_SE
MM\Sound\WaveArchives\WARC_SE_2.wav移动到MM\Sound\WaveArchives\WARC_SE
1

评分人数

用move。。。。。。。

TOP

回复 2# 707093864
能不能帮帮忙弄个批量BAT啊?

TOP

本帖最后由 pcl_test 于 2016-7-7 20:02 编辑

如何把TXT移动到与TXT文件名相同的文件夹
例如:
BANK_DENSETU.TXT移动到Sound\Banks\BANK_DENSETU
BANK_ENVIROMENT.TXT移动到Sound\Banks\BANK_ENVIROMENT
BANK_FOLK.TXT移动到Sound\Banks\BANK_FOLK
BANK_FUKUROU.TXT移动到Sound\Banks\BANK_FUKUROU
BANK_ITEM.TXT移动到Sound\Banks\BANK_ITEM

TOP

没看懂你的意思

TOP

  1. @echo off
  2. for %%i in (*.txt) do (
  3.     move /y "%%i" "Sound\Banks\%%~ni"
  4. )
复制代码

TOP

test.bat 放在B文件夹下面
  1. @echo off
  2. for /f "delims=" %%i in ('dir /b /s *.txt') do (
  3.     move /y "%%i" "..\C\"
  4. )
复制代码

TOP

楼主好可怜。

TOP

本帖最后由 pcl_test 于 2016-7-7 20:02 编辑

怎么移动这些WAV文件到相对应的文件夹?
看一楼!!!
1

评分人数

TOP

本帖最后由 /zhqsystem/zhq 于 2015-11-9 03:55 编辑

回复 9# a574045075
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. for /f "delims=" %%i in ('dir/a-d/s/b/l/on "%~dp0\MM\Sound\WaveArchives\*.wav"') do (
  4. set "name_dpnxi=%%i"&set "name_nxi=%%~nxi"
  5. set "name_nxi=!name_nxi:_=\!"
  6. for /f "delims=" %%j in ("!name_nxi!") do (
  7.   set name_dpnxi=!name_dpnxi:_%%~nxj=!
  8.   echo "%%i" "!name_dpnxi!\%%~nxj"
  9. )
  10. )
  11. pause
复制代码
这么好的论坛你上哪找,运行测试环境为6.1.7601-64
注:请遵守互联网信息安全,勿用于非法用途

TOP

本帖最后由 a574045075 于 2015-11-9 08:08 编辑

回复 10# /zhqsystem/zhq
这个不行 文件还是在原来的位置?

"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_2_0.wav
" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_2\0.w
av"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_2_1.wav
" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_2\1.w
av"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_2_2.wav
" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_2\2.w
av"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_3_0.wav
" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_3\0.w
av"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_3_1.wav
" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_3\1.w
av"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_3_2.wav
" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_3\2.w
av"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_bgm_all
_0.wav" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc
_bgm_all\0.wav"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_bgm_all
_1.wav" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc
_bgm_all\1.wav"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_bgm_all
_2.wav" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc
_bgm_all\2.wav"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_se_0.wa
v" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_se\0
.wav"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_se_1.wa
v" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_se\1
.wav"
"c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_se_2.wa
v" "c:\documents and settings\administrator\桌面\mm\sound\wavearchives\warc_se\2
.wav"
请按任意键继续. . .

TOP

哈哈,简直蠢。

TOP

本帖最后由 a574045075 于 2015-11-9 09:09 编辑

回复 12# 依山居
不好意思 我对批处理一点不懂 又没时间学习!

TOP

回复 11# a574045075
写的太完整就会使人懒惰,如果是伸手党我认可不发这个帖子,只把主要代码发出来其实是最好的,希望楼主不要做伸手党回显值等于实际运行值简单替换都不会的话直接回我删了此帖,免得浪费空间
这么好的论坛你上哪找,运行测试环境为6.1.7601-64
注:请遵守互联网信息安全,勿用于非法用途

TOP

回复 13# a574045075


    有时间问没时间学?
下载安装python3 https://www.python.org/downloads/ 代码存为xx.py 双击运行或IDLE打开F5运行

TOP

返回列表