πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.misc
Article #3907

Re: Creating a dir with current date (sysvariable)

#3907
From: John Savage
Date: Mon, 22 Jan 1996 00:00
31 lines
1928 bytes
jorgen.gustafsson@mailbox.swipnet.se (JοΏ½rgen Gustafsson) wrote:
> I'm trying to write a backup routine, my question is:
> Is it possible to create a directory (or a filename) with the  current
> date?

The easiest method would seem to involve creating a file or directory
named 96-01-22 when your DATE format is 01-22-1996. To do this just
truncate the date and prepend the "96-" string. Of course, this will
be good for only 12 months, after which you will need to edit the .bat
and change the 6 to a 7. (It's easy enough to automate that part, too,
but just doesn't seem worth the extra typing.)

DATEFILE.BAT
------------
@echo off
goto %1S
:S
copy %0.bat + nul >nul
dir %0.bat|find /i "%0 " >tmp.bat
tmp.bat
:BATS
set                                               date=96-%3
del tmp.bat

As written, an environment variable is set to the date, so you
can then create your file or directory based on the value %DATE%

Note: you must edit what I've typed and add additional spaces between
      SET and DATE to push that digit 3 right over into column 124.
--
John Savage               koala@sydney.dialix.com.au
Technical Details
Message-ID: <4dvnna$a25$1@sydney.DIALix.oz.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4dnon8$ap7@mn5.swip.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10d683,22705cd3ee44f41d,start
X-Google-Attributes: gid10d683,public
X-Google-Thread: f53ba,22705cd3ee44f41d,start
X-Google-Attributes: gidf53ba,public
X-Google-Thread: f71eb,a1b5498e7de6a89b
X-Google-Attributes: gidf71eb,public
X-Google-Thread: 104805,a1b5498e7de6a89b
X-Google-Attributes: gid104805,public
From: John Savage <koala@sydney.dialix.com.au>
Subject: Re: Creating a dir with current date (sysvariable)
Date: 1996/01/22
Message-ID: <4dvnna$a25$1@sydney.DIALix.oz.au>
X-Deja-AN: 136261841
sender: koala@sydney.DIALix.oz.au
references: <4dnon8$ap7@mn5.swip.net>
organization: Gumleaf Smoke Signals Telegraph Co.
newsgroups: comp.os.msdos.misc,comp.sys.ibm.pc.misc,aus.computers.ibm-pc,alt.msdos.batch