Jump to content

Recommended Posts

Posted

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!

thx

Soroush


Posted

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!

thx

Soroush

Hmmm.

Something like this might do:

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
IF /I %1.==/S. SET param=/S&SHIFT
SET Target=%1
FOR /F "tokens=* delims=" %%A IN ('DIR /B %param% %target%') DO (
SET points=0
SET filename=%%~nA
SET DD=!filename:~0,2!
SET MM=!filename:~2,2!
SET YY=!filename:~4,2!
IF !DD! leq 31 SET /A points+=1
IF !MM! leq 12 SET /A points+=1
IF !YY! leq 99 SET /A points+=1
IF !points!==3 SET filename=!YY!!MM!!DD!!filename:~6!&ECHO REN %%~dpnxA !filename!%%~xA
)

jaclaz

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...