Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am looking for a program that will allow me to batch change all the files in a directory to their date stamp, of course replacing / for - and something with the time stamp. I have searched for this and cannot find a program to change their filenames to the files date/time stamp.
Thanks in advance for any help.

That sounds more like a script. Might have better luck posting in the scripting and programming forums.
Give a person a fish you feed them for a day.
Ask a person to internet search and they learn a skill for a lifetime.

Hi jfreak53
This help
@echo off
rem Replace FileNames with Date & Time
if "%1"=="" goto Err
setlocal EnableDelayedExpansiondir %1 /b /a-d >~Temp1.txt
type nul > ~Temp2.txt
for /f %%a in (~Temp1.txt) do (
set Line=%%~ta
set Line=!Line:/=-!
set Line=!Line::=.!
ren xx\%%a "!Line!"%%~xa
)
del ~Temp?.txt
exit /b
:Err
echo Usage: BatchFile.bat DirectoryName

you might want to search this link/url
http://www.jpsoft.com/help/index.htm?echo.htm
Override Across the Universe with Fiona Apple

I tried the script that dtech10 posted in a batch file, and all it does is give me a Syntax of the Command is Incorrect error during the set fase. It writes nothing to the temp2 file and all it writes to the temp1 file is the filenames, which is fine, but where does it get the dates from. I needed the files to be renamed to their respective date and times, not the current. Any help would be appreciated.
Thanks

Hi jfreak53
Opps must have been late and not thinking straight or too much beer.
Try This
%%~ta should contain the Date & Time of the file.
put and echo before the line
ren %%a "!Line!" to see whats echoed.@echo off
rem Replace FileNames with Date & Time
if "%1"=="" goto Err
setlocal EnableDelayedExpansionfor %%a in (%1\*.*) do (
set Line=%%~ta
set Line=!Line:/=-!
set Line=!Line::=.!
if not "%%a"=="%1\!Line!" (
ren %%a "!Line!"
))
exit /b
:Err
echo Usage: BatchFile.bat DirectoryName

![]() |
Can't Install Service pac...
|
Battlefield 2 limited use...
|

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