#42949 - 2003-07-17 11:28 AM
Archiving Files Append Date/Time Stamp
|
Paul Hutchins
Fresh Scripter
Registered: 2003-07-17
Posts: 9
Loc: London, England
|
Before I begin, I am new to this scripting!
I wonder if you could help me?
I want to archive files and append the date/time stamp on the file name.
copy file1.txt file1datetimestamp.txt
Thanks in advance
Paul
|
|
Top
|
|
|
|
#42955 - 2003-07-17 11:52 AM
Re: Archiving Files Append Date/Time Stamp
|
Paul Hutchins
Fresh Scripter
Registered: 2003-07-17
Posts: 9
Loc: London, England
|
Thankyou for your replies.
I will be running the script on NT. I have tried the following but is does not work.
Break OFF
If 1=Exist("C:\new\FIXServer.log") Copy "C:\new\FIXServer.log" "C:\new\FIXServerfile@year.@monthno.@mdaynolog" EndIf Exit
Should I try the rename command?
|
|
Top
|
|
|
|
#42956 - 2003-07-17 11:53 AM
Re: Archiving Files Append Date/Time Stamp
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
|
Top
|
|
|
|
#42957 - 2003-07-17 11:55 AM
Re: Archiving Files Append Date/Time Stamp
|
Paul Hutchins
Fresh Scripter
Registered: 2003-07-17
Posts: 9
Loc: London, England
|
Constructive critism comes to mind.....
So what should the syntax be?
|
|
Top
|
|
|
|
#42960 - 2003-07-18 12:00 AM
Re: Archiving Files Append Date/Time Stamp
|
Paul Hutchins
Fresh Scripter
Registered: 2003-07-17
Posts: 9
Loc: London, England
|
Thanks for your time.
|
|
Top
|
|
|
|
#42962 - 2003-07-18 12:12 AM
Re: Archiving Files Append Date/Time Stamp
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
|
Top
|
|
|
|
#42963 - 2003-07-18 12:40 AM
Re: Archiving Files Append Date/Time Stamp
|
Richie19Rich77
Seasoned Scripter
   
Registered: 2002-08-16
Posts: 624
Loc: London, England
|
Example code with the date format appended to the end of the folder that you are backing up.
E.G E:\CapitalCharge - 240503\
code:
$DATE = SubStr( @DATE, 9, 2 ) + SubStr( @DATE, 6, 2 ) + SubStr( @DATE, 1, 4 ) MD "E:\CapitalCharge - $DATE" Copy "C:\CapitalCharge" "E:\CapitalCharge - $DATE" /h
This may be of some help.
Thanks
Rich
|
|
Top
|
|
|
|
#42965 - 2003-07-17 05:08 PM
Re: Archiving Files Append Date/Time Stamp
|
Paul Hutchins
Fresh Scripter
Registered: 2003-07-17
Posts: 9
Loc: London, England
|
Hi,
Thank you for your reply to my little problem.
This is my script so far
code:
If 1=Exist("C:\new\FIXServer.log") Copy "C:\new\FIXServer.log" "C:\new\FIXServer@mdayno.@monthno.@year.log" If @error ? "error occured: @error - @serror" ? "script will exit once you press a key" Get $ Exit 1 EndIf EndIf
The problem I now have is that I need to put a time stamp in the file name as well. The time stamp is required, because if the file is written twice (due to a restart of a service) I will loose a log that has already been archived.
All your help appreciated.
|
|
Top
|
|
|
|
#42967 - 2003-07-17 05:13 PM
Re: Archiving Files Append Date/Time Stamp
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#42968 - 2003-07-17 05:14 PM
Re: Archiving Files Append Date/Time Stamp
|
Paul Hutchins
Fresh Scripter
Registered: 2003-07-17
Posts: 9
Loc: London, England
|
So where would the following fit in my script?
code:
$datetime=join(split(@DATE,'\'),'-')+join(split(@TIME,':'),'-')
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|