|TOPIC SYNOPSIS |
Ok Gaetano, job done. However I will make a synopsis of this topic in order to be useful to others. Most people will not read each piece of a long post like that to find the useful part.
So, lets resume the topic (to begin, be complacent with my English).
Gaetano has some folders with mp3 files. Filename format is <title><number>.
But his mp3 player queues the audio files in a Windows98 style:
To solve this, the numeric part of filenames have to be converted into 000n format, for instance:
I cant let you go 0003 , my life is in your hands 0050 , come back to me 0800.
(Always a 4 digits number if any number in filenames exceeds 9999)
The following bat do this conversion, remembering that it is presumed this specific file format: <title><numer>, without any number in title part.
@echo off&setlocal enabledelayedexpansion
for /f "tokens=* delims=" %%a in ('dir /b *.mp3') do (
set /a ct=0
rename "!ffile!" "!newfile!.mp3"
set /a ct=%ct%-1
for %%j in (0,1,2,3,4,5,6,7,8,9) do (
if "%%j"=="%x%" (
set /a numb=%numb%
if %numb% lss 10 set newfile=%newfile%000%numb%&goto :eof
if %numb% lss 100 set newfile=%newfile%00%numb%&goto :eof
if %numb% lss 1000 set newfile=%newfile%0%numb%&goto :eof
To convert into a <number><title> format its only to do a litle change in 3 last lines of the bat, before 'goto :eof'.
The final solution to Gaetano is in Response n.9, but it's a bit specific to his own case.