Odi's DOS tools for long file names
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ALWAYS GET THE LATEST VERSION FROM http://odi.webjump.com/
AND READ THIS BEFORE ASKING QUESTIONS!
Contents
--------
1. Overview
2. Description
3. Known bugs
4. Where can I report bugs and get the latest version?
5. FAQ
6. License
7. Acknowledgements
1. Overview
1.1 What's this?
----------------
These tools provide easy file management under DOS with long filenames created by
Windows 95/98 on FAT32, FAT16 and FAT12 file systems. To take full advantage of these
tools, run them in pure DOS mode - not a DOS box under Windows. As far as I know this
is the only completely FREE solution to handle long filenames in DOS.
To show you what I mean: Open up a DOS box in Windows 95 and type DIR - it will
display long filenames. Do the same in DOS mode and you will only get the short
names. Copy a file with a long filename in DOS mode and it will lose its long name.
Using my LFN Tools you can just feel like in a DOS box when you are actually in DOS
mode. Typing LDIR brings up the directory with its long filenames. Copying a file
with LCOPY preserves long filenames. You can even create directories (LMD) with long
names or rename files (LREN) with long names.
1.2 What is it not?
-------------------
It is NOT an extension of DOS. All your DOS programs can NOT handle long file names
even with these tools. (I should mention that there is a driver called LFNDOS that
provides the Microsoft Long Filename API under DOS. You can find it somewhere on the
web.) Other file systems than FAT and ISO-9660/Joliet for CD-ROMs are not supported
yet. Thus these tools do not work on Apple Mac-Drives, Windows NT-Drives, Linux etc.
But they run on Iomega ZIP drives. They are not supposed to run in a DOS-Box under
Windows nor are they supposed to handle any short names. Use the generic DOS commands
instead.
1.3 Who may need these tools?
-----------------------------
Anyone who has Windows 9x running. Anyone who wants to make a backup copy of his
Windows. Anyone who loves good old DOS. Anyone who must work in DOS mode for
maintainance of the OS. Are you reinstalling Windows cause it's wrecked and want to
backup all your data? Bought a new Harddrive and do not want to reinstall Windows?
LCopy it! Want to restore your Windows directory from a ZIP drive or CD-ROM? Try it!
1.4 What do the tools do?
-------------------------
Each tool corresponds to a DOS equivalent but can handle long file names and FAT32.
LDIR.EXE List a directory/folder like DIR
LCD.EXE Changes to any directory/folder like CD
LREN.EXE Renames a file like REN
LDEL.EXE Deletes a file line DEL
LCHK.EXE Display information about a volume
LCOPY.EXE Copies files better than COPY
LMD.EXE Creates a directory like MD
LRD.EXE Removes a directory like RD
1.5 How do the tools work internally?
-------------------------------------
They do not use the common DOS calls to handle files and/or directories. Instead they
access disks directly either through BIOS INT 25h and 26h or Int 21h function 7305h,
depending on the version of operating system. For CD-ROM access Int 2Fh function 15h
is used. Thus only FAT file systems and ISO9660/Joliet are supported.
1.6 What's new?
---------------
To find out what version you have run LCHK. For details see history.txt.
Release 1.50 fixes lost clusters with LCOPY if file could not be copied, minor issue
in LCHK. LFN Tools are now compatible with Windows Millenium.
1.7 A note on CD-ROM file systems
---------------------------------
On Windows platforms mostly two file systems (FS) are used for CD-ROMs at the same
time: ISO-9660 and Microsoft Joliet (which is optional). Windows uses Joliet if
available. DOS always uses ISO. ISO can either store short names in uppercase OR long
names (31 characters) in a reduced ASCII character set. Long names are converted to
short ones in DOS. Joliet always uses long filenames in Unicode characters. There
exists no fixed relation between ISO filenames and Joliet filenames. To support
relative paths I had to match those filenames though. I finally assumed that files
are listed in the same order in both directories. So the 12th file in the ISO FS is
the same as the 12th file in the Joliet FS. ***However there is no guarantee that
this assumption is correct everywhere!*** So watch out for unpredictable results when
dealing with relative path names.
Examples: "E:French" is a relative path name to the current directory of drive E. Its
absolute path name may be "E:\Languages\French".
E:\LANGUA~1>Ldir french this is relative!
E:\LANGUA~1>Ldir \languages\french this is absoltute!
E:\LANGUA~1>Lcd french this is relative!
E:\LANGUA~1\French>Lcd .. this is relative!
E:\LANGUA~1\French>Ldir even this is relative!
This is the reason for the /I switch. Rule: Check relation between short and long
names with LDir, before copying from CD-ROM.
1.8 Multisession CD-ROMs
------------------------
LFN Tools are capable of accessing previously recorded sessions on Multisession CD-
Rs. LCHK can list all tracks on a CD. Every track containing DATA is considered a
"session" and has its own file system. Sessions can include or "overwrite" files from
previous session. A new session can "delete" a file by simply not making a directory
entry for it. With LFN Tools you are able to recover such "deleted" files.
2. Description
Note: When working with long filenames files do not need to have any extension or can
have more than one. For example: "Mailbox", "Mail from Mama.txt", "Book.doc.zip".
Thus wildcards do behave slightly different. (Microsoft's DOS Box instead keeps the
behaviour compatible to DOS.) To select all files use a single * instead of *.*.
Because *.* would select all files containing a dot - and most of the directory names
don't!
Switches need not be separated by spaces anymore. However when using /Tnn it must be
followed by a space if additional switches are specified. Otherwise they are ignored!
2.1 LDIR
--------
This command displays the specified directory if supplied a long directory name.
Without parameters it displays the current directory. If the path or filename
contains spaces double quotes are required (see example). You can use the common
wildcards (?,*) to restrict the output to certain files. Use asterix to abreviate a
long directory name. The /a switch displays hidden files too. The /b switch displays
only long file names; no date/time information. The /s switch displays all
subdirectories. When viewing large directories use the /p switch to pause listing
between screen pages. Witch the /c switch you can turn off the cache. This will slow
down the whole thing a bit, but consumes less memory (~128 KB). The /I and /T
switches are for CD-ROM only. /I forces LDIR to use ISO file system rather than
Joliet. /T must be followed by the number of a valid data track and a space. The
track number identifies which session to use. When /T is absent the last session
recorded is used. Use LCHK to display valid track numbers.
Syntax: LDIR [drive:][path][filename] [/?] [/A][/B][/S][/P]
[/C][/I][/Tn]
Example: D:\WINDOZE>LDIR "C:\new folder\*.txt"
. .
13.01.1999 19:49 .
.. . 13.01.1999 19:49 ..
NEWTEX~1.TXT 1247 13.01.1999 20:02 New textfile.txt
D:\>LDIR w*
WINDOZE . 13.01.1999 19:49 Windoze
D:\>LDIR w*\
. . 13.01.1999 19:49 .
.. . 13.01.1999 19:49 ..
NEWTEX~1.TXT 1247 13.01.1999 20:02 New textfile.txt
2.2 LCD
-------
This command changes the current working directory to the specified location. Unlike
the corresponding DOS command LCD changes directly to a specified drive (see
example). LCD will change to the first matching directory it meets. In addition
wildcards can be used in pathnames. The first item occuring in the directory
structure (this could be a file!) is used. The /I and /T switches are for CD-ROM
only. /I forces LDIR to use ISO file system rather than Joliet. /T must be followed
by the number of a data track. The track number identifies which session to use. When
/T is absent the last session recorded is used. Use LCHK to display valid track
numbers.
Syntax: LCD [drive:]pathmask [/?][/I][/Tn]
Example: D:\WINDOZE>LCD "C:\new folder"
C:\NEWFOL~1>LCD ..
C:\>LCD pro*\onli*
C:\PROGRA~1\ONLINE~1>
2.3 LDEL
--------
This command deletes the specified file(s). You can use the common wildcards (?,*) to
select more than one file. The /a switch also deletes files with the read-only
attribute set. Hidden, system etc. files are NOT affected by /a. The /p switch asks
you before deleting each file wheter to proceed or not. With the /c switch you can
turn off the cache. This will slow down the whole thing a bit, but consumes less
memory (~128 KB). To delete all files in a directory use "LDEL *" istead of "LDEL
*.*".
Syntax: LDEL [drive:][path\]file [/A][/P][/C][/?]
Example: C:\TEMP>LDEL *.txt
Letter from Al.txt deleted
My memories.txt deleted
C:\TEMP>LDEL "E:\Garbage folder\*"
Trash 1.dat deleted
Trash 2.file deleted
2.4 LREN
--------
This command assigns a new long name to a file or directory. Do not use any wildcards
(?,*); rename only a single file or directory. You will not be able to rename a file
to a name containing unicode characters such as the Euro Symbol. Renaming to a short
name does not remove the long name; its case is stored in this place for example.
Syntax: LREN [drive:][path\]filename newfilename [/?]
Example: C:\TEMP>LREN "An important file.txt" "Not so important any more.txt"
C:\TEMP>
2.5 LCOPY
---------
This command copies one or more files to any destination. You can use wildcards (?,*)
to select more than one file. If files in the destination directory already exist
they are OVERWRITTEN without notice to the user (only if the target file is not read-
only)! If the destination is omitted the current drive and directory are used. The
switch /S copies also all subdirectories with their contents. When using the /D
switch together with /S all matching files in all subdirectories are copied to the
destination directory and no subdirectories are created. Mind that if files with
equal names are overwritten without notice! The switch /A copies also hidden files.
If /A and /S are combined even hidden directories are copied. This makes XCOPY nearly
obsolete. Witch the /c switch you can turn off the cache. This will slow down the
whole thing a bit, but consumes less memory (~128 KB). You can abort the operation by
pressing any key. [The "any" key is the space bar ;-)] The /B switch turns off this
feature. The /I and /T switches are for CD-ROM only. /I forces LDIR to use ISO file
system rather than Joliet. /T must be followed by the number of a data track. The
track number identifies which session to use. When /T is absent the last session
recorded is used. Use LCHK to display valid track numbers.
Syntax: LCOPY [drive:][path\]sourcefile [drive:][destination]
[/?][/S [/D]][/A][/C][/B][/I][/Tn]
Example: C:\TEMP>LCOPY "*.text" A:\BACKUP\
A Secret.text
An important.text
2 file(s) copied
C:\TEMP>LCOPY "A Secret.text" "D:\WEB\Now A Public.text"
A Secret.text
1 file(s) copied
C:\TEMP>LCOPY C:\WINDOWS\* "D:\WRECKED SYSTEMS" /A /S /B
The last line would copy the entire operating system to another directory. You are
not allowed to abort the operation.
C:>LCOPY . D:\ /S
The last line would copy the directory structure only (no files). With switches /S
LCOPY always mirrors the directory structure, even if no matching file is found.
C:\>LCOPY *.ZIP C:\ARCHIVES /S /D
The last line would copy all zip files on drive C to the directory \ARCHIVES. No
subdirectories are created.
2.6 LMD
-------
This command creates a new subdirectory (folder).
Syntax: LMD [drive:][path\]newdir [/?]
Example: C:\>LMD "Backup Folder"
Ok.
C:\>LCD Backup*
C:\BACKUP~1>D:
D:\>LMD "C:Apr 1,1999"
Ok.
This creates a new Folder called "Apr 1,1999" in "Backup Folder" on drive C.
2.7 LRD
-------
This command removes a subdirectory (folder).
Syntax: LRD [drive:][path\]dirname [/?]
Example: C:\>LRD "Backup Folder"
Ok.
2.8 LCHK
--------
This command displays information about a disk. This information is taken from the
disk's boot sector. This command works on CD-ROMs as well. It displays detailed
information on how many tracks (sessions) are on the CD-ROM. Use the track numbers
displayed for the /T switch of LCOPY, LDIR and LCD.
Syntax: LCHL [drive:]
Example: C:\>LCHK D:
Version 1.41
Copyright (C) 1999 Ortwin Glueck
This is free software under GPL. See the readme file for details.
DOS Version: FF-7.10
Drive: 3
Bytes per Sector: 512
Sectors per Cluster: 8
Reserved Sectors: 32
Number of Clusters: 917916
Number of FATs: 2
Number of Root entries: 0
Media Descriptor: f8
Sectors per FAT: 7179
Sectors: 7357707
First Data Sector: 14390
First Root Sector: 14390
First Root Cluster: 2
Root Sectors: 0
Fat entries per Sector: 128
Label:
File System: FAT32
FAT32 compatible disk access enabled
Volume locking enabled
3. Known bugs and features
--------------------------
- The DOS command line can not exceed 127 characters! (use asterix to abbreviate
directories). Even batch file command lines will only pass 126 characters!
- You can not use LCOPY to create a file whose name equals the drive label in the
drive's root directory.
- One user reported problems when copying from CD to SCSI harddrive. IDE is ok.
- If a directory contains long file names no longer associated with any file, LDIR
may display some incorrect long file names. It does not recognize the directory
beeing corrupt. Repair the directory with scandisk.exe.
- Only Unicode characters from codepages 00h and 25h are translated. Unknown
characters are converted to underscore (_). May cause non-unique filenames!
- LRD: You can remove the current working directory without notice.
- If a disk's boot record reports a wrong FAT format, FAT is corrupted (lcopy, lmd,
lrd). This can especialy happen on (old) wrong formatted floppy disks. Check the
filesystem with the LCHK tool first. 1.44MB-Diskettes should always be FAT12.
- FAT32: Only the first copy of the FAT is used for reading. Changes are ALWAYS
written to all copies (mirroring).
- FAT32 hard drives can only be accessed if the DOS version supports FAT32. Otherwise
the drive is not assigned a drive letter. Use a Win98 or Win95B boot diskette.
- CD-ROMs can only be accessed if a CD-ROM driver is loaded (MSCDEX). Otherwise the
drive is not assigned a drive letter.
- I have made a short test with IDE-ATAPI Iomega ZIP drives. LFN Tools seem to work
fine on them. However one user reported problems when writing which I could not
reproduce.
4. Where can I report bugs and get an updated version?
------------------------------------------------------
Any comment is to be sent to the e-mail address supplied on my homepage. I speak
German and English.
Odi's LFN Tools are still under light development. So be sure to check for a newer
version each 6 months or so. Type lchk to find out what version you have.
Get the latest version from WWW: http://odi.webjump.com/
This site is not very fast and has sometimes access problems!
Maybe I will move this page. If it is not there anymore try http://go.to/odi or
search the web and Usenet for "Odi's LFN Tools". You can try and search SimtelNet
too.
5. FAQ
------
Q: I have problems with my home burned CD-Rs. I cannot see long filenames.
A: Learn how to use your CD recording software and read about CD-ROM standards.
Q: I cannot see long filenames on ANY CD-ROM.
A: Get at least version 1.49. If problem persists write me an e-mail.
Q: I want to support your work with my money.
A: Good. If you want to spend less than 100$ forget it. Otherwise send me an e-mail.
Q: I get an error message when going to your homepage.
A: Try again. The server is not the best.
Q: I have programmed a DOS utility. Could you convert it to handle long names?
A: Definitely not! Fix it yourself. You have the LFN source code.
6. License
----------
This is free software under the GNU General Public License. No warranty. Source code
(C++) available on http://odi.webjump.com/. If you can not compile the code with your
favourite compiler this is YOUR problem. I can not help you compile the code.
See the license.txt file included in the ZIP archive.
7. Acknowledgements
-------------------
I would like to say thank you to the following persons.
Frank Littmann, Mario Latzig for hints on filename problem with Joliet
(God, was I blind!)
Bill Hall for some good hints
Isy for two bug reports
H. Ellenberger for the bug report in 1.42
Benjamin Wells for his note on LCOPY *.TXT C:\FUN /S
Mark Marinac for his hints on ZIP drives and compression
Michael Marquart for the hint on DOS 6 and extensive testing
Leanne & Walt Smith for the IBM PC-DOS testing
Gordon Chaffee for Unicode support (Linux kernel)
The Linux people who helped me out with the ISO structs
Corinne for her love