Solved Rename files in subfolders based on folder or other file?

January 11, 2017 at 13:57:55
Specs: Windows 7, Xeon 3GHz / 4gigs

Since Kodi is updated i cant get my library to work properly, its a filename that is wrong.

Folder: Kids movies
Sub-folder: Aladdin
Files in sub-folder: Aladdin.mkv, poster.jpg, Aladdin-fanart.jpg and Aladdin.nfo

Now the problem is that the poster.jpg must be named Aladdin-poster.jpg for everything to work.

Its about 400 sub-folders with the same structure so it should be best to use the folder-name or the nfo filename to fix this.

I am new to this, but i have read some batch coding and edited som batch files but not more than that.

Thank you for reading this.

Best Regards Richard Sabelström

See More: Rename files in subfolders based on folder or other file?

Report •

January 11, 2017 at 19:34:24
:: -------- begin test-script "fixxx.bat"
@echo off>fixx.bat & setlocal
for /f "tokens=*" %%a in ('dir /b /s poster.jpg') do (
call :xx %%~pa
type fixx.bat
goto :eof

set k=%1
set k=%k:~0,-1%
for %%b in (%k%) do >>fixx.bat echo ren %1poster.jpg %1%%~nb-poster.jpg
::========== end script
For safety reasons all output goes to fixx.bat. Don't run fixx.bat until you are satisfied that it flies straight. It seemed to work on my end, but "ya know how that goes".

message edited by nbrane

Report •

January 12, 2017 at 02:32:30
✔ Best Answer
Didnt get it to work, but thanks.

Used Bulk Rename Utility.

Didnt work on network so had to move the library arund but now its working :-)

Report •
Related Solutions

Ask Question