How to create batch file move files up 1 level rename dups?

April 7, 2018 at 14:09:54
Specs: Windows 8
I already have a batch file that I can drop in any SHOW_NAME directory and it will move files from a sub-folder to its SEASON parent directory. For example:

F:\TV_SHOWS\SHOW_NAME\SEASON1\TITLE_EP1\title_episode1.mkv
F:\TV_SHOWS\SHOW_NAME\SEASON1\TITLE_EP2\title_episode2.mkv
F:\TV_SHOWS\SHOW_NAME\SEASON1\TITLE_EP3\title_episode3.mkv
F:\TV_SHOWS\SHOW_NAME\SEASON1\title_episode3.mkv

When it moves all files to the parent folder (SEASON1) the "title_episode3.mkv" is a duplicate and overwrites the original. How can I automatically rename by appending a number "title_episode3 (1).mkv"?

Here is the code that I use in a batch file:

@echo off
for /d /r %%f in (*) do (
for /d %%g in ("%%f\*") do (
for %%h in ("%%~g\*.mkv") do move "%%~h" "%%~f" >nul 2>&1
)
)
Thanks!

message edited by curbano72


See More: How to create batch file move files up 1 level rename dups?

Report •

#1
April 8, 2018 at 00:00:46
"How to create batch file move files up 1 level rename dups?"

Never heard of "dups" - - what are they?


Report •
Related Solutions


Ask Question