RE: Append date/time stamp to logfile name (NT 4.0)
Hello, Not sure if this is what you're looking for but you can use the following in a batch file: for /f "tokens=2-4 delims=-/ " %%i in ('date/t') do set filedate=%%k%%j%%i for /f "tokens=1-2 delims=: " %%i in ('time/t') do set filetime=%%i%%j ren logfile.log %filedate%%filetime%.txt This assumes your NT date format is "-MM-dd" or "/MM/dd"and your time format is "HH:mm:ss" or "H:mm:ss" both of which are configurable in CONTROL PANEL --> REGIONAL SETTINGS. HTH -- Chris J. Guidry P.Eng. ATCO Electric, Metering Services Phone: (780) 420-4142 Fax: (780) 420-3854 Email: [EMAIL PROTECTED] > -Original Message- > From: Speaks, Chuck W. [SMTP:[EMAIL PROTECTED]] > Sent: Thursday, August 23, 2001 12:06 PM > To: Multiple recipients of list ORACLE-L > Subject: Append date/time stamp to logfile name (NT 4.0) > > OS: NT 4.0 > > I have scheduled a query against a database that pipes results to a log > file. > > Ex. Select * from any_table; >logfile.txt > > Since I need a trend on this query I need to keep the logfile names > unique. > Best case scenario is to append a date/time stamp to the logfile name as > in > 230820011200.txt (daymonthyeartime). Does anyone know how to do this with > NT scripting? Any help would be greatly appreciated. > > Thanks, > > Chuck Speaks > Database Administrator > Lithonia Lighting > 770-860-3450 > http://www.lithonia.com > > > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: Speaks, Chuck W. > INET: [EMAIL PROTECTED] > > Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 > San Diego, California-- Public Internet access / Mailing Lists > > To REMOVE yourself from this mailing list, send an E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Guidry, Chris INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: Append date/time stamp to logfile name (NT 4.0)
Chuck, It's doable, and I've seen scripts on the net that do it, but it's a bit cumbersome. However, you could also do it in sqlplus, using spool, where the name of the spool file is taken from a new_value of a date query, i.e., col x new_value fn select to_char (sysdate, 'DDMMHHMI') || '.txt' x from dual; spool &fn hth, yosi "Speaks, Chuck W." wrote: > OS: NT 4.0 > > I have scheduled a query against a database that pipes results to a log > file. > > Ex. Select * from any_table; >logfile.txt > > Since I need a trend on this query I need to keep the logfile names unique. > Best case scenario is to append a date/time stamp to the logfile name as in > 230820011200.txt (daymonthyeartime). Does anyone know how to do this with > NT scripting? Any help would be greatly appreciated. > > Thanks, > > Chuck Speaks > Database Administrator > Lithonia Lighting > 770-860-3450 > http://www.lithonia.com > > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: Speaks, Chuck W. > INET: [EMAIL PROTECTED] > > Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 > San Diego, California-- Public Internet access / Mailing Lists > > To REMOVE yourself from this mailing list, send an E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). -- Thanks, Yosi - Yosi Greenfield Oracle Certified DBA [EMAIL PROTECTED] -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Yosi Greenfield INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Append date/time stamp to logfile name (NT 4.0)
OS: NT 4.0 I have scheduled a query against a database that pipes results to a log file. Ex. Select * from any_table; >logfile.txt Since I need a trend on this query I need to keep the logfile names unique. Best case scenario is to append a date/time stamp to the logfile name as in 230820011200.txt (daymonthyeartime). Does anyone know how to do this with NT scripting? Any help would be greatly appreciated. Thanks, Chuck Speaks Database Administrator Lithonia Lighting 770-860-3450 http://www.lithonia.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Speaks, Chuck W. INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).