问题描述
结果
的我这是做以下批处理脚本的这一部分:的结果
-there是一个主文件夹,在主文件夹有两个文件(电影和放大器;字幕文件)和一个子文件夹称为字幕搜索结果
- 此脚本采用电影文件的名称,并用它重命名字幕文件+字幕文件移动到字幕子文件夹,然后重命名main文件夹。所以最终我们有一个电影的名字,这是对字幕文件和主文件夹使用为好。搜索结果
关闭@echo
SETLOCAL EnableDelayedExpansion
CD / D%〜DP0
回声基本文件夹:%CD%
设定N = 0
针对/ D %%一中(*)做(
集/ A N + = 1
CD%%一个
回声================================================= =================
回波处理文件夹:%%一
在%% B(* .AVI * .MP4 * .mkv)视频做设定的movieName = %%〜铌
回声电影名称:!的movieName!
在(* .SRT * .SUB)%% b执行(
移动%% B字幕\\!的movieName!%%〜Xb的
回声文件%% B移动和重命名为字幕\\!的movieName!%%〜Xb的
)
CD ..
仁%%一个!的movieName!
回声文件夹%%一个重命名为!的movieName!)
回声================================================= =================
回声%N%FOLDERS PROCESSED
暂停
!!!!!我需要的是以下几点:!!!!! 结果
- 我需要使它反之亦然,所以在名称会从主文件夹中采取并没有从电影文件,因此主文件夹的命名将是对电影和字幕文件即可。搜索结果中使用谢谢!
关闭@echo
SETLOCAL EnableDelayedExpansion
CD / D%〜DP0
回声基本文件夹:%CD%
设定N = 0
针对/ D %%一中(*)做(
集/ A N + = 1
CD%%一个
回声================================================= =================
回波处理文件夹:%%一
设置的movieName = %%〜一
在%% B(* .AVI * .MP4 *的.mkv)做(
仁%%〜B!的movieName!%%〜Xb的
回声电影文件%% B重命名为!的movieName!%%〜Xb的
)在(* .SRT * .SUB)%% b执行(
移动%%〜B字幕\\!的movieName!%%〜Xb的
回声文件%% B移动和重命名为字幕\\!的movieName!%%〜Xb的
)
CD ..)
回声================================================= =================
回声%N%FOLDERS PROCESSED
暂停
I have this part of batch script which is doing following:
-There is a main folder, in the main folder are two files (movie & subtitle file) and one Sub-folder called 'Subtitles'
-This script takes the name of the movie file and renames with it the subtitle file + moves the subtitle file into the 'Subtitles' sub-folder and then renames the main folder. So at the end we have one movie name, which is used on the subtitle file and on the main folder as well.
@echo off
setlocal EnableDelayedExpansion
cd /D "%~DP0"
echo BASE FOLDER: %cd%
set n=0
for /D %%a in (*) do (
set /A n+=1
cd "%%a"
echo ==================================================================
echo Processing folder: %%a
for %%b in (*.avi *.mp4 *.mkv) do set movieName=%%~Nb
echo Movie name: !movieName!
for %%b in (*.srt *.sub) do (
move "%%b" "Subtitles\!movieName!%%~Xb"
echo File "%%b" moved and renamed to "Subtitles\!movieName!%%~Xb"
)
cd ..
ren "%%a" "!movieName!"
echo Folder "%%a" renamed to "!movieName!"
)
echo ==================================================================
echo %n% FOLDERS PROCESSED
pause
!!!!! What I need is following: !!!!!
-I need to make it vice versa, so the name would be taken from the main folder and not from the movie file, so the name of the main folder would be used on the movie and on the subtitle file.
Thank you!
@echo off
setlocal EnableDelayedExpansion
cd /D "%~DP0"
echo BASE FOLDER: %cd%
set n=0
for /D %%a in (*) do (
set /A n+=1
cd "%%a"
echo ==================================================================
echo Processing folder: %%a
set movieName=%%~a
for %%b in (*.avi *.mp4 *.mkv) do (
ren "%%~b" "!movieName!%%~Xb"
echo Movie file "%%b" renamed to "!movieName!%%~Xb"
)
for %%b in (*.srt *.sub) do (
move "%%~b" "Subtitles\!movieName!%%~Xb"
echo File "%%b" moved and renamed to "Subtitles\!movieName!%%~Xb"
)
cd ..
)
echo ==================================================================
echo %n% FOLDERS PROCESSED
pause
这篇关于如何根据通过批处理脚本自己的文件夹名称重命名文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!