list.txt中有以下檔案名
光輝歲月.mp3
江南.mp3
吻別.mp3
春江花月夜.mp3
漁舟唱晚.mp3
……
這些檔案分布于D:\音樂 檔案夾中,其中該檔案夾下有經典、純音樂、傷感等歌曲分類的子檔案夾, mp3檔案存盤于這些子檔案夾中。
求高手幫助,如何批量將list.txt中的音樂mp3檔案批量復制到 D:\目標檔案夾 中呢?
uj5u.com熱心網友回復:
把sourcePath和targetPath分別替換為音樂和目標檔案夾即可
@echo off
setlocal enabledelayedexpansion
set sourcePath=E:\Test\source
set targetPath=E:\Test\target
set /a copyCount=0
dir /s /b !sourcePath!>filelist.txt
for /f "delims=" %%i in (list.txt) do (
find "%%i" filelist.txt > findfile.txt
if !errorlevel! equ 0 (
for /f "skip=2 delims=" %%j in (findfile.txt) do (
copy /y %%j !targetPath!\%%i>nul
set /a copyCount+=1
)
)else (
echo can't find file %%i
)
)
del filelist.txt
del findfile.txt
echo ************************************
echo copy file success: !copyCount!
pause
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/115719.html
標籤:Windows客戶端使用
下一篇:Windows的誤區
