Hoping someone here can help with this.
I'm copying my music library (or parts thereof) onto a micro-sd card to use in my Android phone. After some fiddling around, I found that in order to display the album image on the phone you need to have a JPG called "folder". The music exists as ripped with Windows Media, which creates 4 JPG files, one of which is called "folder.jpg". However, that is the lowest quality image.
Copying the entire file structure is easy enough with the XCOPY command and including the JPG files is equally a breeze. However, i'm looking for a batch the will cycle through the created folder structure and rename the largest JPG file to "folder.jpg".
Any help appreciated here!!
Batch to recursively copy and rename files
Moderator: DosItHelp
Re: Batch to recursively copy and rename files
Code: Select all
for /f "delims=" %%A in ('dir /b /ad /s') DO (
PUSHD "%%A"
for /F "delims=" %%G in ('dir /b /a-d /OS *.jpg') do set largest=%%G
rename "%largest%" "folder.jpg"
POPD
)
Re: Batch to recursively copy and rename files
Simple change - you'd have to use Move /y to overwrite the smaller file.
Re: Batch to recursively copy and rename files
foxidrive wrote:Simple change - you'd have to use Move /y to overwrite the smaller file.
Agreed.