Computing.Net > Forums > Disk Operating System > Rename file to date.time.txt

Rename file to date.time.txt

Reply to Message Icon

Original Message
Name: mcrpds
Date: November 6, 2003 at 13:52:16 Pacific
Subject: Rename file to date.time.txt
OS: win2k
CPU/Ram: p2
Comment:

Hello techies,
I have this script but it gives me an error trying to rename export.txt to export.date.time.txt format, any ideas?
C:\Inetpub\wwwroot>copy export.txt export.11062003.1:36p.txt
The filename, directory name, or volume label syntax is incorrect. 0 file(s) copied.
here is my script:
For /F "tokens=* delims=:. " %%D in ('Time /T') Do Set TM=%%D
For /F "tokens=2-4 delims=/ " %%A in ('Date /T') Do copy export.txt export.%%A%%B%%C.%TM%.txt

Thank you for your time!


Report Offensive Message For Removal


Response Number 1
Name: dtech10
Date: November 6, 2003 at 15:07:37 Pacific
Subject: Rename file to date.time.txt
Reply: (edit)

Hi
it's the colon in time that's the problem
it not allowed in a filenane.
try changing the first line to this.

For /F "tokens=1,2lims=:. " %%D in ('Time /T') Do Set TM=%%D%%E


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Rename file to date.time.txt

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge