Solved

Truncated file names in DOS

Posted on 2004-04-16
7
1,354 Views
Last Modified: 2009-07-29
Hello all,

Just a quick question which I'm sure you'll find easy to answer.

A little while ago I had a friend whose computer crashed.  The only way to cover their files was to copy the data via DOS to another drive which I had slaved to the machine.  However, once the machine was restored, I noticed that all the files which I had copied retained their truncated dos-file names and did not convert to the long file names used by Windows.

Was there something that I could have done to preserve the long file names or was this unavoidable?

Thanks,

Auriclus
0
Comment
Question by:Auriclus
  • 3
  • 2
  • 2
7 Comments
 
LVL 6

Expert Comment

by:mrdtn
Comment Utility
There is a program called LFNBACKUP.exe on the Windows CDROM.  This is what you would have needed.  Typing "lfnbackup.exe /?" should also tell you how to restore once the files are copies.  Unfortunately, I don't have the program in front of me, so I can only provide you with this level of information.  Google on LFNBACKUP.EXE for a bunch of additional info if you need it.

--

mrdtn
0
 
LVL 5

Author Comment

by:Auriclus
Comment Utility
Thanks for pointing me in the right direction, Mrdtn.  I searched for LFBACKUP.exe but came up empty handed but then realized the name is actually LFNBACK.exe and it's located on the Windows 98 CD in the resource kit.

Now, does this utility run under DOS?  Because in the circumstances I was in before, the system had crashed and Windows was unbootable.  So would of it been possible to access file within DOS and then proceed with copying the files to the slave drive?

Auriclus
0
 
LVL 6

Expert Comment

by:mrdtn
Comment Utility
Okay, it turns out that LFNBACKUP.EXE is not the actual file name -- in fact it would be odd I would think that it be a long filename itself(!!).  I dug up a 98 CD and it is in fact located in

D:\TOOLS\reskit\file\lfnback\lfnbk.exe

D being my CD drive letter at the moment.

Typing lfnbk /? gives you the following information:

lfnbk: long file name backup/ restore utility Version 4.0
       (c)Copyright Microsoft Corp 1993-1996
usage: lfnbk [/v] [/b | /r | /pe] [/p] [c:]
       /v         verbose mode
       /b         back up and remove long file names
       /pe        extract errors from backup database
       /r         restore backed up long file names
       /nt        do not restore backed up date and times
       /p         find long file names but don't convert
       /a         backup or restore file attributes
       /force     force lfnbk to run even if not safe

--
Yes - It must be run from a DOS environment.

--

mrdtn
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 6

Accepted Solution

by:
mrdtn earned 25 total points
Comment Utility
A Windows 95 discussion on using lfnbk (from MS's site):

If you need to use an earlier version of a hard disk utility in Windows 95, perform the following steps:

NOTE: The long filename backup utility (Lfnbk.exe) is not supported in Windows NT 4.0. There is no comparable utility for Windows NT 4.0.
Run Lfnbk.exe, which is a long filename (LFN) backup utility available in the \\Admin\Apptools\Lfnback folder of the Windows 95 CD.

Lfnbk.exe removes your long filenames and saves them to a data file. Read LFNBK.TXT for more information.
Restart your computer and use the appropriate step below:
If you need to run an MS-DOS-based utility, press the F8 key when you see the "Starting Windows 95" message, and then choose Command Prompt Only from the Startup menu.

-or-
If you need to run a Windows-based utility, allow Windows 95 to start normally.
After you run the utility, restart your computer and run Lfnbk.exe to restore your long filenames.


--

LFNBK.txt from Windows 95 CD:

Using the LFNBK Utility

Most hard disk utility programs released before Windows 95 require updating to work correctly with Windows 95. If you use a hard disk utility that was not created especially for use with Windows 95, you might lose long filenames and you are at risk of losing data. Examples of such programs include the
following:

* Norton Utilities® by Peter Norton Computing
* PC Tools  by Central Point Software, Inc.
* Microsoft Defragmenter for MS-DOS version 6.0, 6.2, 6.21, or 6.22
* Stacker 4.0 by STAC Electronics

In special cases, you might need to run backup or disk management utilities created for older versions of Windows or MS-DOS that are not compatible with the extended file system capabilities of Windows 95. Or you might need occasionally to run an application that is not compatible with long filenames. In such cases, you can use the LFNBK utility to remove (and later restore) long filenames on a disk.

To install the LFNBK utility:
* From the Windows 95 compact disc, copy LFNBK.EXE to the Windows directory on your computer.

CAUTION
The LFNBK utility is intended for use only by experienced Windows 95 users with special needs for compatibility with older disk utilities. It is not intended for everyday use by average users. Microsoft recommends that users rely on the disk management utilities included with Windows 95 or use Windows 95-compatible utilities from other vendors, rather than attempting to use older utilities that are not compatible with Windows 95.

Notice also that the DriveSpace utility included with Windows 95 is compatible with long filenames and can be used without LFNBK to manage compressed disks created with older versions of DriveSpace or DoubleSpace.

The following shows the syntax for LFNBK:

lfnbk [/v] [/b | /r | /pe] [/nt] [/force] [/p] [<drive>]

The following table describes the parameters for this command.
      
/v      Reports actions on the screen.
/b      Backs up and removes long filenames on the disk.
/r       Restores previously backed-up long filenames.
/pe      Extracts errors from backup database.
/nt      Does not restore backup dates and times.
/force      Forces LFNBK to run, even in unsafe conditions.
/p      Finds long filenames, but does not convert them to 8.3 filename
aliases. This reports the existing long filenames, along with the
associated dates for file creation, last access, and last modification of
the file.

To preserve long filenames with disk utilities that do not recognize them:

1. Turn off tunneling.
To do this, in the System option in Control Panel, click the Performance tab, and then click File System. In the File System Performance dialog box, click the Troubleshooting tab, and check the option named Disable Long Name Preservation for Old Programs.

2. Close all other applications. LFNBK cannot rename open files.

3. At the command prompt, type lfnbk /b [<drive>] to back up and remove long filenames.

4. Restart the computer, and then run the disk utility. If it is an MS-DOS - based utility, run it in MS-DOS Mode. For a Windows-based utility, run it in the usual way.

5. At the command prompt, type lfnbk /r [drive] to restore long filenames.

6. Turn tunneling on again, and then restart the computer.

The LFNBK utility actually renames each file with a long filename to its associated alias. The filename changes are stored in the LFNBK.DAT file in the root of the drive where you are running LFNBK. This file is used to restore long filenames (when you run LFNBK with the /r switch).

The following list provides some brief notes for using the LFNBK utility:

* You cannot use LFNBK to repair long filename problems.

* LFNBK might not be able to rename files with exact matches to long-filename aliases (i.e. the associated 8.3 name paired with each long-file name), and the related alias is not guaranteed to be the same as before running LFNBK.

* After you run LFNBK and then restart Windows 95, the default Start menu will appear, rather than your custom Start menu. After you run lfnbk /r to restore long filenames, your custom Start menu will also be restored.

* If the directory structure changes after you run lfnbk /b, then long filenames cannot be restored with lfnbk /r. For example, if you run a disk utility that prunes or removes subdirectories, LFNBK cannot restore the long filenames within those subdirectories.
0
 
LVL 10

Assisted Solution

by:Mercantilum
Mercantilum earned 25 total points
Comment Utility
The problem is the dependancy of the File system.
If you want something safe and simple, take the unix way on your DOS available system:

Get the free proven famous program "tar.exe" for windows (dos) from cygwin ....(info: http://cygwin-lite.sourceforge.net/details.html)

>Backup (or *.* recursively, ie including directories), go to the top dir of all data:

   tar.exe cvf  backup.tar  *.*

>Restore (go where you want to restore the files with cd)

    tar.exe xvf  [pathto]backup.tar

That's it. One file is created for the whole backup, its name being backup.tar (8.3) no problem... and its content is your backup with long names.
This will work (include long file names) as long as tar.exe is able to get them from the system.


=Something else=

Take the hard disk and plug in as a secondary drive in another long-file-names able computer (windows, linux...)
This way you access the files exactly as the are.
0
 
LVL 10

Expert Comment

by:Mercantilum
Comment Utility
...and I should have said that tar.exe is about 150Kb... (fits on a floppy)
0
 
LVL 5

Author Comment

by:Auriclus
Comment Utility
Thanks to all.  I'll try those utilities next time I am in the same situation.

Auriclus
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now