Novell Home

Delete or Rename Files with Corrupted Filenames

Novell Cool Solutions: Tip
By Greg Riedesel

Digg This - Slashdot This

Updated: 6 Jul 2007
 

Problem:

Have you ever been asked to delete a directory that Explorer said was not empty but you can't find any files in there? Or you can see a file, but Explorer won't delete it? I've run into this several times and I've developed a routine to get rid of the bad files.

Solution:

What causes this behavior in Explorer is corrupted file-names. The NSS file-system keeps track of four different names for each file:

  • Dos 8.3 names
  • Windows-style long names
  • Macintosh names
  • UNIX/NFS names

Things can get screwy when the Long name gets broken. I've seen cases where the file in question contains characters out of keeping with my environment, or just plain missing! Stuff like this can be fixed on a volume level with a pool rebuild, but that is an offline process and you can't exactly do that in the middle of the day (yet). So you need a way to get rid of, or rename, the bad file.

I use five different tools when handling files of this type:

  • Windows CMD prompt
  • NSSCPT
  • NetStorage
  • Novell Remote Manager (NRM)
  • Novell FTP
  • NetWare console utility 'TOOLBOX'

CMD Prompt

Sometimes, you can 'del' a file that you can't get rid of in Explorer. Explorer uses different rules for 'valid filename' than CMD does.

Additionally, you can get some information out of the bad name. If you run the "dir /X" command it will list the 8.3 names generated for the bad filename. This can be used in later steps to isolate which file you are dealing with.

NSSCPT

NSSCPT stands for "NSS Code Page Tool", and was introduced in Service Pack 2 for NetWare 6.5 as a way to fix Mac namespace errors. Apple changed how they handled filenames between OS 9 and OS X, and this tool was created to address issues surrounding that. Since then, as of Service Pack 3, Novell has built in another feature that is quite handy for taking care of namespace corruption.

The command-line we're interested in is -fixnames. There isn't a lot of documentation about NSSCPT, so this is what the command-line help says:

USAGE: NSSCPT <pathspec> [-D] -FIXNAMES 

WHERE: <pathspec> is a directory name (DOS) to be processed 
       -D enables display of directory names being processed 
       -FIXNAMES corrects invalid names in the server code-page 

EXAMPLE: NSSCPT VOL1:\ -D -FIXNAMES

The above command will parse all the files and directories on VOL1, and validate their names. It is unclear if this is a safe command to run on an entire volume if you have files with certain unicode names, so I stick with using it just to fix identified problems. For that it works pretty well.

To fix a specific directory tree, use the -FIXNAMES flag:

NSSCPT USER1:\ALBERS\MYLOTUS\ -FIXNAMES

There is a log-file to check to see what changes were made. You can find that in SYS:ETC\NSSCPT.LOG. It is unix-formatted (end-of-line is just a line-feed, not line-feed and a carriage return that Windows uses) and may contain Unicode characters so Wordpad works best for reading it on Windows machines. This file will tell you what got changed.

NetStorage

The NetStorage product is sometimes able to delete or rename files that Explorer can't touch. This comes from using different rules, and perhaps it also checks against the UNIX/NFS namespace for names as well. I've had fair luck with this tool.

Novell Remote Manager

Like NetStorage, this tool sometimes can delete or rename files that Explorer can't. You browse the volume from the top-level on down the directories. Once you get into the directory with the bad file, you can select the 'file info' link to rename or delete. Sometimes the corruption is bad enough that it just can't handle it. For that, go to the big bat.

NetWare FTP

Somewhere along the line Novell implemented some 'SITE' commands in NWFTPD. These can be quite useful in catching these files. You can find the documentation for these commands here. Using SITE commands within a text-based FTP client such as the one that comes with Windows is simple. You issue the command like this:

ftp> quote SITE DOS

200 Desired Name Space Set to "DOS"
ftp>

This will tell NWFTPD to use the DOS namespace (8.3 names) for directory listings. By default it uses the LONG namespace, this command allows you to see the short names. Since it is almost always the LONG name that gets corrupted, this can be a great way of gaining access to 'bad' files. Most FTP clients implement the "REN" command that allows you to rename files, which will make the file visible everywhere.

TOOLBOX

If you load TOOLBOX with the "-NL" option, it'll load in a mode where it only sees the 8.3 names. So far, this tool has worked almost every time I've had to deal with a corrupted file-name. Use the DIR command to work your way down to the affected directory.

Directory of: SMISRV1/CLASS1:/wrn/spring06/z-corr~1/344-cr~1/dropbox/norm_l~1/myexpe~1.doc

Note the 8.3 names. In this specific case, the file was completely missing a long name and wasn't visible at all in Explorer. NRM gave an empty file-entry for it, but was not able to delete or rename it. In the end I was able to "RM" it from the console.

If all of these methods fail to get rid of the file, you have a few more options depending on your environment:

  • Load a DOS workstation and try to view the data. Delete from there.
  • Attach a Mac to the volume in question, and attempt to view the data.
  • From an NFS client, view the data and delete from there.

And if all else fails, the only thing left is an offline PoolRebuild after a PoolVerify.

Environment:

  • NetWare 5.1 for all but the NWFTP trick and NSSCPT.
  • NWFTPD as of at least NetWare 6.5SP3, possibly earlier.
  • NSSCPT as of at least NetWare 6.5SP3.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell