sponsor Vim development Vim logo Vim Book Ad

Get Win32 Short Name : Works out the 8.3 short-name of an existing file

 script karma  Rating 10/4, Downloaded by 1755  Comments, bugs, improvements  Vim wiki

created by
Michael Geddes
 
script type
utility
 
description
Since writing this, I've discovered heaps about short names.  There are many caveats, but the biggest 3 are:
1) After the first 4 similar names, windows uses a hash algorithm to work out the 3rd-6th letters of the name.
2) Samba uses a different hash algorithm to work out the short name
3) There is a Win32 API function call to set the short name of a file.

This script contains a function that works out only simple win32 8.3 short versions of a filename.  It will
work unless there are more than 4 files with the same name.

I have since written a patch for Vim6.1 which will allow windows users acces to the short-filename via the api call... expect it soon.. (via fnamemodify and probably using the modifier :8 )

NOTE: This is part of Vim 6.1 -
     echo fnamemodify( 'c:\vim\plugins\shortname.vim', ':8')

Eg
echo GetWin32ShortName('c:\vim\plugins\shortname.vim')

should produce:  c:\vim\plugins\shortn~1.vim
or something like that.

 
install details
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
shortname.vim 1.0 2002-09-29 6.0 Michael Geddes Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github