Thank you
Thomas
<idiot from Dell commercials> DUDE! This is DOS! </idiot>
DOS is not case-sensitive. Never has been, never will be. Even modern
DOS's aren't case-sensitive. (For that matter, Windows isn't
case-sensitive either, and (I believe) neither is pre-X MacOS.) Try it -
in the directory that already has "aAaA.TxT", try to create "aaaa.txt".
You'll get asked if you want to overwrite "aAaA.TxT" and if you answer
no, creation is cancelled.
If you want a case-sensitive OS, switch to a UN*X system. BSD, Linux,
QNX, and a buncha others are available for free on the internet.
--
auric "underscore" "underscore" "at" hotmail "dot" com
*****
My system goes down more often than a $10 whore.
First, get its filename using "dir /b"
Then, pipe this into MS find or grep
Then, replace the IF EXIST <file> with IF ERRORLEVEL 1
i.e.:
replace
IF EXIST aaaa.txt DO-SOMETHING
with
DIR /B | FIND "aaaa.txt"
IF ERRORLEVEL 1 DO-SOMETHING
On the face of it, this is that rarest of all questions: a stupid one.
There must be something more involved since file names are *not* case
sensitive in MS operating systems and all variations in case of the
same name point to the same file. What are you trying to do?
If MSDOS were actually involved, the filenames would all be upper case
anyway.
T.E.D. (tda...@gearbox.maem.umr.edu - e-mail must contain "T.E.D." or my .sig in the body)
First, the MS-DOS and Windows file systems are case preserving, not
cast sensitive. You could not have two such files in the same
directory in any case. You would need to have the batch file run a
program written in (most likely) a real compiled programming language
to tell the difference.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
> On the face of it, this is that rarest of all questions: a stupid one.
> There must be something more involved since file names are *not* case
> sensitive in MS operating systems and all variations in case of the
> same name point to the same file. What are you trying to do?
>
> If MSDOS were actually involved, the filenames would all be upper case
> anyway.
That is almost, but not quite true. As it happens, I run into a
somewhat similar problem very recently on a Win95 system. The long
filename versions are case-sensitive in the way some application
sort them. Even if e.g. top0236a.htm and TOP0236A.HTM will point to
the same file. I had a mix of such data file names (in daily
financial accounts, but that's beside the point) with consecutive
numbers like
Top0236a.htm
Top0237a.htm
TOP0238a.htm
top0239a.htm
Top0240a.htm
The file list order of was affected in a browser window. Now what I
did was to rename all the files from mixed case to upper case.
Problem solved.
Anyway, my point is that the existence of mixed cases in MS-DOS is
not totally moot. Only if one runs a truly vanilla MS-DOS, which
very seldom is the case any more.
All the best, Timo
--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Useful batch files and tricks ftp://garbo.uwasa.fi/pc/link/tsbat.zip
Mixed case names exist in Win9x as long file names, and long file
names are stored separately from the real directory entry - the real
directory entry is for the upper case short name.
The only case that suggests itself where filename case might actually
make a difference is if the directory is actually a samba (or other)
share from a case sensitive file system. Since the HDD is corrupt on
my home Linux system at the moment, I can't check that until Monday at
work. (Its UPS failed and the system crashed once too often due to
thunderstorm power failures.)
> [cut]
> Anyway, my point is that the existence of mixed cases in MS-DOS is
> not totally moot. Only if one runs a truly vanilla MS-DOS, which
> very seldom is the case any more.
Yet running "real" MS-DOS (or other compatible OS's) is still
going on in the real world despite Bill Gates. I mostly read mail and
news on a Linux shell account which I dial or telnet into. When my
main computer went down (power supply took nearly everything else with
it), I resurrected an old MS-DOS machine to be able to get back in.
(I'm glad I never threw it into the trash, as I am rather poor and did
not have the money at the time to replace the big Win98 box).
--
Paul Bartlett
bartlett at smart.net
PGP key info in message headers
File names are passive; they are neither case-sensitive nor case-
insensitive.
When a filename is given to indicate a file to be operated on, or
created, in a Win95+ system, then the code that implements the file-
finding is case-insensitive (at least, within A-Z; it is clear that
MSDOS cannot treat codepage 437 SIGMA and sigma the same at the start of
a filename).
When a filename is found and reported, the way it is presented depends
on the finder. 16-bit-compatible code will go only for the SFN (with
possible exceptions in pre-LFN code; my HUNT needed a change to prevent
it finding each fragment of each LFN), stored in upper case; 32-bit-
compatible code will generally go for the LFN, and preserve case.
The OP's question is fully meaningful, apart from the terminological
error (I would fain say inexactitude; but the combination has already
been established as a euphemism) in the last line - Win2000/XP batch is
not MSDOS batch, but a development thereof.
Actually, since true MS-DOS creates only upper-case SFNs, the actual
search may well be case-sensitive after upper-casing the supplied target
name. One could, in a proper MSDOS system, create a file called TEST,
use Norton or maybe Debug to change it on disc to TesT, then see whether
TYPE TEST (or TesT) would find it, and what DIR might do.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; Win98. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
Close, but that looks like it is going to also find files such as
"baaaa.txt", "aaaa.txtra", "waaaa.txt.bak", etc. A space after the
opening quote will only go part of the way to getting around this.
--
John Savage (news address invalid; keep news replies in newsgroup)
How about:
DIR /B | GREP -qx "aaaa.txt"
or in WinNT/2k/XP:
DIR /B | FINDSTR /X /C:"aaaa.txt"
I wish the UNIX GREP came with MSDOS. It comes with WinNT / Win2k /
WinXP as FINDSTR.
You can use FINDSTR in WinNT/2k/XP, or you can get GREP with DJGPP.
FIND is useless in these situations, unless you use something like PASTE
to insert spaces before and after the lines, but it's still useless with
filenames with spaces (ARGHH!).
The "DIR /B" lists the directory in bare format, one file per line and
no fluff.
The GREP:
-qx is:
-q - "quiet" mode
-x - match only whole lines.
"aaaa.txt": the search string.
And I made a little mistake.
The
IF EXIST ...
should be
IF NOT EXIST ...
There are several share/freeware ports of [efx]grep to DOS, and you
should be able to find one on SIMTEL or other places. For example:
1) xgrep v 1.3 (c) 1994 Robert Nordier
2) grep and egrep by Barry Schwartz
3) dgrep and fgrep from ???
4) grep/cgrep/bmgrep from Ian Stewartson's 1994 UNIX-to-DOS package
I don't recall why, but I tend to use 1) and 2) most of the time.
--Myron.
--
Five boxes preserve our freedoms: soap, ballot, witness, jury, and cartridge
PhD EE (retired). "Barbershop" tenor. CDL(PTX). W0PBV. (785) 539-4448
NRA Life Member and Certified Instructor (Home Firearm Safety, Rifle, Pistol)