Computing.Net > Forums > Disk Operating System > Rename File with Timestamp in 24hrs

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to get for your free account now!

Rename File with Timestamp in 24hrs

Reply to Message Icon

Name: akabir77
Date: August 6, 2008 at 08:37:50 Pacific
OS: XP
CPU/Ram: Centrino
Manufacturer/Model: DELL
Comment:

Hi I need to run a batch file which will move a file to a location while renaming it. I got the moving part but can't figure out how to get the date and 24 hour added to the file name.


Report Offensive Message For Removal

Sponsored Link
Ads by Google

Response Number 1
Name: akabir77
Date: August 6, 2008 at 09:44:21 Pacific
Reply:

Ok I found this code which is adding the date and time.

@ECHO OFF
for /f "tokens=2-4* delims=/ " %%a in ('DATE /T') do set THEDATE=%%c%%b%%a

For /F "tokens=2-4 delims=:" %%a in ('Command /C Echo. ^| Time ^| Find "current"') Do Set

THETIME=%%a%%b%%c


Set THETIME=%THETIME:~1%

copy /Y/V C:\Temp\Batch\ORLREC.dat C:\Temp\Batch\ORLREC%THEDATE%%THETIME%.dat

copy /Y/V C:\Temp\Batch\Sorted3.csv C:\Temp\Batch\Sorted3%THEDATE%%THETIME%.csv


PAUSE

But the out put is like
ORLREC20080608114216.16.dat
Sorted320080608114216.16.csv

See the . before the 16. What do i need to change the code so that i don't get that?

I need the output to be
ORLREC20080608114216.dat
Sorted320080608114216.csv


Report Offensive Follow Up For Removal
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Rename File with Timestamp in 24hrs

Rename File with Timestamp in 24hrs www.computing.net/answers/dos/rename-file-with-timestamp-in-24hrs/14267.html

Rename file with current date www.computing.net/answers/dos/rename-file-with-current-date/13069.html

HELP Renaming files with a .bat file www.computing.net/answers/dos/help-renaming-files-with-a-bat-file-/3679.html