[AccessD] Code to render ShortFileName

Stuart McLachlan stuart at lexacorp.com.pg
Sun Mar 30 17:03:36 CST 2003


> It seems to work well, but I think MS must have changed the rules since I
> last looked:
> 
> ? shortpath("e:\program files\microsoft sql server\mssql\data")
> e:\PROGRA~1\MI6841~1\mssql\data
> 
> 

Looks like it.  They've probably found that some  people have more than 9 directories 
starting with the name Microsoft in Program Files, thanks to their brilliant default 
directory naming scheme. 

I just ran a test on my  E:\Program Files (W2k, NTFS)

I've got four directories that start with tthe word Microsoft that return 
...\MICROS~x\

Anything new I add now that starts with "Micros" gets MI and a four digit hex number.

Later:

This got ime interested so I just did a search:

http://www.microsoft.com/technet/prodtechnol/windows2000pro/reskit/part3/proch17.as
p

"Windows NT and Windows 2000 do not use the same algorithm to create long and 
short file names as Windows 95 and Windows 98. However, on computers that use a 
multiple-boot process to start these operating systems, files that you create when 
running one operating system can be accessed when running another."

.....

"When there are five or more files that can result in duplicate short file names, Windows 
2000 uses a slightly different method for creating short file names. For the fifth and 
subsequent files, Windows 2000: 

Uses only the first two letters of the LFN. 
Generates the next four letters of the short file name by mathematically manipulating 
the remaining letters of the LFN. 
Appends ~1 (or another number, if necessary, to avoid a duplicate file name) to the 
result. 
This method substantially improves performance when Windows 2000 must create 
short file names for a large number of files with similar LFNs. Windows 2000 uses this 
method to create short names for files on both FAT and NTFS volumes. "




-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System Support.





More information about the AccessD mailing list