soroush Posted March 17, 2012 Posted March 17, 2012 Hey guys, I have followed your conversation and it was very interesting. I have a similar problem.I am looking for a script or some batch file/folder renamer that can read a portion of a file lets say the first 6 digits and is able to reorder the format! I have many folders and files starting with amercian standrad dating format like MMDDYY or MMDDYYYY. I like the format to be reordered to YYMMDD. This will help me and many others to sort their files by name and still to be sorted by date! Pictures and picture folders are very good to be named by this format!Please advize!thxSoroush
jaclaz Posted March 17, 2012 Posted March 17, 2012 Hey guys, I have followed your conversation and it was very interesting. I have a similar problem.I am looking for a script or some batch file/folder renamer that can read a portion of a file lets say the first 6 digits and is able to reorder the format! I have many folders and files starting with amercian standrad dating format like MMDDYY or MMDDYYYY. I like the format to be reordered to YYMMDD. This will help me and many others to sort their files by name and still to be sorted by date! Pictures and picture folders are very good to be named by this format!Please advize!thxSoroushHmmm.Something like this might do:@ECHO OFFSETLOCAL ENABLEEXTENSIONSSETLOCAL ENABLEDELAYEDEXPANSIONIF /I %1.==/S. SET param=/S&SHIFTSET Target=%1FOR /F "tokens=* delims=" %%A IN ('DIR /B %param% %target%') DO (SET points=0SET filename=%%~nASET DD=!filename:~0,2!SET MM=!filename:~2,2!SET YY=!filename:~4,2!IF !DD! leq 31 SET /A points+=1IF !MM! leq 12 SET /A points+=1IF !YY! leq 99 SET /A points+=1IF !points!==3 SET filename=!YY!!MM!!DD!!filename:~6!&ECHO REN %%~dpnxA !filename!%%~xA)jaclaz
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now