From: bharris@hfglobe.intel.com (Bennie Harris)
Newsgroups: comp.os.msdos.misc
Subject: Re: Help--Space in filename..can't read/write/copy
Date: 10 Nov 92 18:14:50 GMT
Organization: Intel Corporation

bern@Uni-Trier.DE (Jochen Bern) writes:

>In <Bwy4xn.Ktu@watserv1.uwaterloo.ca> Roger De Abreu <roger@wateol.uwaterloo.ca> writes:
>>Help !  An underline(space) was put into one of my filenames (eg.
>>cos_102.txt) and 
>>now I can't read or copy the file.   Anyone know how I can correct the
>>filename or
>>at least retrieve the data.

>OK, I think this is worth a longer Posting ...

>MSDOS inherited its internal Structure, i. e. Procedures, from two different
>OSes: CP/M and Unix. CP/M was the former Standard for PC-sized Machines, but
>it didn't support (Sub)Directories. Unix did. This lead to the Fact that most
>internal Procedures for File and Directory Handling exist TWICE, one Version
>based on CP/M and one on Unix. The CP/M-flavored Procedures use File Control
>Blocks (FCBs) to access Files and an additional "cd" Procedure to switch
>Dirs; They DON'T support Access to a File without cding to its Dir. The Unix-
>style Procedures use so-called Handles, identifying Numbers, just like Process
>Numbers or something of this Kind; They ALWAYS ALLOW absolute or relative
>Paths in the Filename.

>FCBs receive Filenames (remember: No Paths) in a 11-Byte Field. You are free
>to fill in WHATEVER Bit Pattern you like. FCB Procs are, thus, able to create
>Files with illegal Names - and to access them.

>Handle Procs use File Names only once (when assigning a Handle to the Object).
>Upon this, they allow Paths and, thus, must parse the String they received.
>This makes the Usage of illegal File Names impossible.

>NOW WE COME TO THE SOLUTION OF THE PROBLEM:

>There are two basically different Approaches:

>1) Use Programs which look at the Directory as the Object to work upon and are
>   able to alter the Name of an Entry. Examples: Norton Utilities, PC Tools,
>   and all other Flavors of Disk Editors.

>2) Use Programs which access the File as their Object BUT USE FCB ROUTINES.
>   They will be able to access the File in any Way you like. This includes:
>   -- Very old XTree Versions (preceding XTree Pro, I think)
>   -- All Programs compiled with Turbo Pascal (well, at least prior to TP 5.0)
>   (Anybody got a bigger List?)

>Final Advice: I don't know what your MSDOS Version is, nor what it uses ITSELF.
>If it uses FCBs, there SHOULD be a Way to access the File without additional
>Software. If it doesn't, CHKDSK should recognize the "lost File" and rename
>it to C:\FILE0000.CHK, which would probably be the easiest Way.

>Hope that helps,
>								J. Bern
>-- 
> /  \  I hate NN rejecting .sigs >4 lines. Even though *I* set up this one. /\
>/ J. \ EMail: bern@[TI.]Uni-Trier.DE / ham: DD0KZ  / More Infos on me from /  \
>\Bern/ X.400 Mail: S=BERN;P=Uni-Trier;A=dbp;C=de  /   X.400 Directory, see \  /
> \  /  Zurmaiener Str. 98-100, D-W-5500 Trier    /     X.29 # 45050230303.  \/


You can also try RENAME cos?102.txt cos102.txt.  
RENAME cos*102.txt cos102.txt should also work if
there are no other files that match the wild card.
-- Bennie Harris
Newsgroups: comp.os.msdos.misc