Page 1 of 1

Date conversion in filename from dd-mm-yyyy to yyyy-mm-dd

Posted: 12 Mar 2011 22:39
by xforce30164
Hi everyone,
I need some help with a batch file im trying to write to mame the renaming of my Podcasts alot easier. I want to do this because in the dd-mm-yyyy format they do not sort properly by name.

The filename buildup is as follows:

"Always the same startpart"[space]dd-mm-yyyy.mp3 and i need it to be renamed to "Always the same start part"[space]yyyymmdd.mp3

All help is appteciated!
Ps. I do have some basic knowledge of batch and already have beennsearching for a bit now and still couldnt find it so i decided to post my question here.

Pps. Please forgive me any spelling mistakes because im kinda tired and its 05:40 here atm ^^.

Re: Date conversion in filename from dd-mm-yyyy to yyyy-mm-d

Posted: 13 Mar 2011 02:24
by !k

Code: Select all

for /f "delims=" %%a in ('dir /b *.mp3 ^|^
ssed.exe -n -R "s/^(.*\s)(\d\d)-(\d\d)-(\d{4})(\.mp3)$/ren \"\1\2-\3-\4\5\" \"\1\4\3\2\5\"/p"'
) do %%a

ssed.exe: http://sed.sourceforge.net/grabbag/ssed/sed-3.62.zip

Re: Date conversion in filename from dd-mm-yyyy to yyyy-mm-d

Posted: 13 Mar 2011 05:09
by xforce30164
Thank you very very much! That solved my problem :D!