Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How could I rename all my digital pictures with the creation date and time concatinated together, instead of the usual counter?

You want to rename all files from a certain folder to their creation date and time, instead of their original names, is that it?
That's possible, I can make a simple script for that. I just need you to say which format would you like. Example:
MMDDYY-HHMM (military time)
ex: 122702-1558DDMMYYYY-HHMM(AM/PM)
ex: 27112002-0358AMOr whatever you want.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

Hi secret_doom:
I am glad to hear that my request is possible. You understand my request perfectly. I would like to change the name of all my pictures in a particular directory to the date and time in the format (YYMMDD-HHMM).
John
jls667@yahoo.com

Ok, here we go! The following batch script will rename the files from the current directory to their creation date and time, with the format YYMMDD-HHMM.extention (the extention will be mantained).
===== BATCH SCRIPT BEGIN =====
@echo offif "%OS%"=="Windows_NT" goto OSOK
echo This program must be run in a NT system.
goto eof:OSOK
if "%1"=="GoTo" goto %2
%comspec% /v /c %0 GoTo start
goto eof:start
for %%? in (*.*) do (
for /F "tokens=1-6 delims=/-: " %%A in ("%%~t?") do (
set MM=%%A
set DD=%%B
set YYYY=%%C
set HH=%%D
set MI=%%E
set AP=%%F
if "!AP!"=="PM" set /A HH += 12
set YY=!YYYY:~-2!
REN %%~s? !YY!!MM!!DD!-!HH!!MI!%%~x?
)
):eof
===== BATCH SCRIPT END =====That's it! If month and day appear swapped, you should swap the green lines. You might want to change the red line (which tells the file format). In this case, mantain the blue part of the line.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br_____________________________________________________

By the way, be careful, the process is unreversible (the original filenames are not stored for eventual reversing).
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

I have no idea why you could get a sintax error. I've tested that script not only on WinXP, but also in Win95Cmd.EXE, which is somekind of Win2000's command interpreter emulator.
Try locating the sintax error: you can run the batch script line-by-line by making the following change on the script:
:OSOK
if "%1"=="GoTo" goto %2
%comspec% /v /c %0 GoTo start
goto eofTo this:
:OSOK
if "%1"=="GoTo" goto %2
%comspec% /v /Y /c %0 GoTo start
goto eofContact me if you locate the sintax error.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

Ooops, forget what I said on my last post about executing the script line-by-line - that /Y thing doesn't work on Win2000.
I still don't know why you get a sintax error, but I found out other things: though that script works on WinXP, it doesn't work as intended on Win2000. I've understimated the differences between these two systems, which are a few but could make a huge difference in some cases.
I've developed another script, which should work on Windows 2000. I can't assure you won't go through the same sintax error, but it's possible that you don't, since the script is different (but I think you will...). Anyway, I'll still post the script for further reference.
===== BATCH SCRIPT BEGIN =====
@echo off
if "%1"=="GoTo" goto %2ver |FIND "Microsoft Windows 2000" > nul
if not errorlevel=1 goto OSOK
echo This program must be run in Microsoft Windows 2000.
goto eof:OSOK
%comspec% /v:on /c %0 GoTo start
goto eof:start
for %%? in (*.*) do (
for /F "tokens=1-6 delims=/-: " %%A in ("%%~t?") do (
set MM=%%A
set DD=%%B
set YY=%%C
set HH=%%D
set MI=%%E
if "!MI:~-1!"=="p" set /A HH += 12
set MI=!MI:~0,-1!:: To activate the script, remove "echo.{demo}" from next line
echo.{demo}REN %%~s? !YY!!MM!!DD!-!HH!!MI!%%~x?)
):eof
===== BATCH SCRIPT END =====The script is de-activated. If you run it like that, it will display the actions that it would take if active. Analise the output, and if those are the desired actions, activate the script (read commented lines for doing so).
That script was tested on Win95Cmd.exe, some sort of Windows 2000's command interpreter emulator. It should work on Windows 2000.
I'm sorry about all the trouble.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br__________________________________________________________

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |