🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: NAMING a file with DATE (WAS: RENAME with variables?)

#3869
From: John Savage
Date: Sat, 24 Feb 1996 00:00
34 lines
1939 bytes
pistrang@crocker.com (Jim Pistrang) writes:
 >needs to rename the file, to save it for backup/archiving purposes.
 >Sure, I can rename it to OUT.DAT with the REN command, but I'd like to
 >give it a unique name on the rename.  Ideally, something that has the date
 >and a sequence number, such as 96022001 (sequence one on 96-02-20).
 >Usually this BAT will run once a day, but there is a possibility of 2 runs
 >in a day, hence the sequence number.

Here is a .BAT which sets an environment variable DATE to string YYMMDD.

DATENAME.BAT
------------
:: called with no arguments sets environ variable DATE, e.g., 960131
@echo off
if "%1"=="[" goto B
if not "%1"=="" goto A
copy %0.bat + nul >nul
dir %0.bat | find /i " bat" >tmpx.bat
tmpx
:A
echo ;|choice /c:;%3; %0 >tmpx.bat
tmpx
:B
set date=%8%9%2%3%5%6
del tmpx.bat

For fast operation use a ramdrive and preface all strings tmpx with d:
As for the sequencing bit, you'll want later lines in the .bat that
calls this one:

set suffix=01
if exists %date%01 set suffix=02
--
John Savage               koala@sydney.dialix.com.au
Technical Details
Message-ID: <4gmp73$dgj$1@sydney.DIALix.oz.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <pistrang-2002960716460001@iplink023.crocker.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d683,74c415f16b818ed2,start
X-Google-Attributes: gid10d683,public
X-Google-Thread: f53ba,74c415f16b818ed2,start
X-Google-Attributes: gidf53ba,public
X-Google-Thread: 104805,74c415f16b818ed2,start
X-Google-Attributes: gid104805,public
X-Google-Thread: f71eb,52539c9500c88cf1
X-Google-Attributes: gidf71eb,public
From: John Savage <koala@sydney.dialix.com.au>
Subject: Re: NAMING a file with DATE   (WAS: RENAME with variables?)
Date: 1996/02/24
Message-ID: <4gmp73$dgj$1@sydney.DIALix.oz.au>
X-Deja-AN: 140849678
sender: koala@sydney.DIALix.oz.au
references: <pistrang-2002960716460001@iplink023.crocker.com>
organization: Gumleaf Smoke Signals Telegraph Co.
newsgroups: comp.os.msdos.misc,comp.sys.ibm.pc.misc,aus.computers.ibm-pc,alt.msdos.batch