Solved create batch file to scan recursivley &

June 26, 2011 at 20:35:27
Specs: Windows 7
down vote favorite

I have looked and couldn't find what suited my needs. I'm hoping to get help here.

I have several sub folders with the file poster.jpg. I need a batch file that will search all these sub folders copy poster.jpg with in the same folder and rename it to folder.jpg. So the File structure looks like this.




I need the batch file to scan the movie folders and copy the poster.jpg and rename it folder.jpg, so it should look like this after the batch file is run.

c:\Videos\Movie1\poster.jpg , folder.jpg

c:\Videos\Movie2\poster.jpg , folder.jpg


I wrote this script but it doesn't seem to scan recursively.

@echo off
For /r e:\dummymovies in (*.jpg) do (Copy /y poster.jpg)

I hope I provided all the information needed to help me accomplish the task.

-Semper Fi

See More: create batch file to scan recursivley &

Report •

June 27, 2011 at 03:40:30
✔ Best Answer
@echo off & setlocal
cd /D C:\Videos
for /R  %%j in (.) do if exist "%%j\poster.jpg" copy "%%j\poster.jpg" "%%j\folder.jpg"

Report •

June 27, 2011 at 08:58:26
Thank you sooooooo much. You just saved this Old Marine from throwing his laptop against the wall!!!!

-Semper Fi

Report •
Related Solutions

Ask Question