Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: how to generate unique file names on Windows.

RE: how to generate unique file names on Windows.

From: Branimir Petrovic <BranimirP_at_cpas.com>
Date: Wed, 24 Sep 2003 12:39:45 -0800
Message-ID: <F001.005D0F41.20030924123945@fatcity.com>

> -----Original Message-----
> From: Murali_Pavuloori/Claritas_at_claritas.com
> [mailto:Murali_Pavuloori/Claritas_at_claritas.com]
> Sent: September 24, 2003 1:45 PM
> To: Multiple recipients of list ORACLE-L
> Subject: how to generate unique file names on Windows.
>
>
>
> Hello,
>
> I am trying to write a script on windows that would export
> the db every
> night. Can someone tell me how to generate unique file names
> on windows...
>
> What I am looking for is the windows equivalent of echo
> `date +%m%d%y`
>
> Thanks in advance.
>
> Murali.
>

Dynamically generated timestamp is what you want. Be warned though that this works only on Win2K and 'better':

C:\>set zdate=_%date:~-4%%date:~7,2%%date:~4,2%
C:\>set ztime=_%time:~0,2%%time:~3,2%%time:~6,2%
C:\>echo %zdate%%ztime%

_20030924_152452

On (not so) good ole NT4 this has to be done:

:: === Create and initialize TIMESTAMP and NOW environment vars: 
::                      set TIMESTAMP=_YYYYMMDD_HHMMSS
::                      set NOW=DD Month YYYY  HH:MM:SS
if EXIST SetTIMESTAMP.bat del /f /q SetTIMESTAMP.bat MakSetTIMESTAMPbat.wsf
if exist SetTIMESTAMP.bat (

    call SetTIMESTAMP.bat
    del /f /q SetTIMESTAMP.bat
)

MakSetTIMESTAMPbat.wsf script dynamically creates SetTIMESTAMP.bat script. Execute that to create and initialize TIMESTAMP environment variable (mail me off-line if you want this script making script).

Sooo much simpler/easier, more logical wouldn't you say than having to remember/worry about meaning of backticks in shell?

Branimir

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Branimir Petrovic
  INET: BranimirP_at_cpas.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (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).
Received on Wed Sep 24 2003 - 15:39:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US