Computing.Net > Forums > Windows 2000 > Rename a file with date and time

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Rename a file with date and time

Reply to Message Icon

Name: Franklin IS
Date: July 14, 2004 at 14:04:20 Pacific
OS: W2K Pro
CPU/Ram: Unknown
Comment:

I am trying to create a batch file that will move a file to 2 different places and then rename the file by the date and time it was moved. I can get it to work with XP but W2k Pro gives me the error "in was unexpected at this time". Here is what I have coded so far:

@ECHO OFF

COPY "C:\AMANDA\ACCT_ENTRY.CSV" "C:\PAYANYTIME BACKUP"
for /F "tokens=1,2,3,4 delims=/ " %%i in ('date/t') do set d=%%l%%j%%k%%i
FOR /F "tokens=1,2,3 delims=:., "%%a in ("%TIME%") do set t=%%a%%b%%c
set t=%t:~0,8%
set DATE-TIME=%d%-%t%
echo %DATE-TIME%
ren "c:\PAYANYTIME BACKUP\ACCT_ENTRY.CSV" "%d%-%t%.csv"

COPY "C:\AMANDA\ACCT_ENTRY.CSV" "Z:\PAYANYTIME"
for /F "tokens=1,2,3,4 delims=/ " %%i in ('date/t') do set d=%%l%%j%%k%%i
FOR /F "tokens=1,2,3 delims=:., "%%a in ("%TIME%") do set t=%%a%%b%%c
set t=%t:~0,8%
set DATE-TIME=%d%-%t%
echo %DATE-TIME%
ren "Z:\PAYANYTIME\ACCT_ENTRY.CSV" "%d%-%t%.csv"

DEL "C:\AMANDA\ACCT_ENTRY.CSV"

COPY "C:\ACCT_ENTRY TEMPLATE.CSV" "C:\AMANDA\ACCT_ENTRY.CSV"


Any help would be appreciated.
Thanks.




Sponsored Link
Ads by Google

Response Number 1
Name: xscript
Date: July 14, 2004 at 14:59:16 Pacific
Reply:

This would be easier as a script, I can give one a go for you if you like

xscript


0
Reply to Message Icon

Related Posts

See More


W2000 keeps getting lsass... Windows 2K / XP local use...



Post Locked

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


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: Rename a file with date and time

Rename a file to date with script www.computing.net/answers/windows-2000/rename-a-file-to-date-with-script/58187.html

Batch file with date www.computing.net/answers/windows-2000/batch-file-with-date/47737.html

bat file to rename file with date www.computing.net/answers/windows-2000/bat-file-to-rename-file-with-date/55851.html