在torrent完成后,应使用文件名创建一个文件夹。应复制(不移动)文件,并添加前缀。 这是我的实际.bat
for /F "Tokens=*" %%i in ('Dir /B *.mp4') do md "%%~ni"|copy "%%i" "%%~ni"
这项工作到目前为止,但我无法添加前缀。该prefx应该添加到文件夹中新创建的文件中。
一种进度条,例如" xx MB of yy MB at aa MB / s Speed"会很好但不是必需的。
答案 0 :(得分:0)
试试这个
for /f "tokens=*" %%A in ('dir /b *.mp4') do (
md "%%~nA"
copy "%%~fA" "%%~nA\prefix_%%~nxA"
)
这将复制abc.mp4 -> abc\prefix_abc.mp4
输出进度
@echo off
setlocal
set _cmd='dir /b *.mp4'
set _prefix=movie_
set _progress_width=40
set _progress_char1=+
set _progress_char2=-
set _progress_char3=+
set _progress_fill=*
set _count=0
set _i=1
rem Counting files
for /f "tokens=*" %%A in (%_cmd%) do set /a "_count+=1"
call :print_scale
for /f "tokens=*" %%A in (%_cmd%) do (
md "%%~nA" >nul 2>&1
copy "%%~fA" "%%~nA\%_prefix%%%~nxA" >nul 2>&1
rem Output progress
call :progress _i _count
call title Completed [%%_i%%/%%_count%%]
set /a "_i+=1"
)
endlocal
exit /b 0
:print_scale
set /a "_width=_progress_width-2"
set "_fill="
for /l %%B in (1,1,%_width%) do call set "_fill=%%_fill%%%%_progress_char2%%"
echo %_progress_char1%%_fill%%_progress_char3%
exit /b 0
:progress
call set _current=%%%1%%
call set _total=%%%2%%
set /a "_width=_progress_width"
set /a "_pos=_width*_current/_total-_width*(_current-1)/_total"
for /l %%B in (1,1,%_pos%) do echo|set /p _z=%_progress_fill%
exit /b 0
这将输出类似
的进度+--------------------------------------+
*************