Converting a Long FIleName to it's short equivalent (Both possible shorts) 
Author Message
 Converting a Long FIleName to it's short equivalent (Both possible shorts)

Hey
I'm trying to do some cleaning up and have some data whose paths were
changed to their short form.  This has happened twice (I finally found
the protect!)  Is there not an API call, function, sometinhg to show me
what the 8 character equivalent would be??

Unfortunately, I've ended up with both the 'closest to longname' and the
123456~8 formats.

Any advice would be appreciated Thanks!

Bill



Sat, 23 Oct 1999 03:00:00 GMT  
 Converting a Long FIleName to it's short equivalent (Both possible shorts)

Quote:

> Hey
> I'm trying to do some cleaning up and have some data whose paths were
> changed to their short form.  This has happened twice (I finally found
> the protect!)  Is there not an API call, function, sometinhg to show me
> what the 8 character equivalent would be??

> Unfortunately, I've ended up with both the 'closest to longname' and the
> 123456~8 formats.

> Any advice would be appreciated Thanks!

> Bill

I'm not sure what your question is. You say that you've ended up with
the 123456~8 format name. That _is_ the short file name. Not knowing
what you're after, the best I can do is point you to GetShortPathName.

        - Chris Kyarsgaard
--
+----------------------------------------------------------------+
| Geronimo Development Corporation    Phone: (800)457-6045       |
| 606 25th Ave. S., Suite 206          Fax: (320)259-9808        |
| St. Cloud, MN  56301            WWW: http://www.casefinder.com |
+----------------------------------------------------------------+



Sun, 24 Oct 1999 03:00:00 GMT  
 Converting a Long FIleName to it's short equivalent (Both possible shorts)

Quote:

> Hey
> I'm trying to do some cleaning up and have some data whose paths were
> changed to their short form.  This has happened twice (I finally found
> the protect!)  Is there not an API call, function, sometinhg to show me
> what the 8 character equivalent would be??

> Unfortunately, I've ended up with both the 'closest to longname' and the
> 123456~8 formats.

> Any advice would be appreciated Thanks!

> Bill

Bill:

Try the following:

Private Declare Function GetShortPathName Lib "KERNEL32"
Alias "GetShortPathNameA" (ByVal lpszLongPath As String,
ByVal lpszShortPath As String, ByVal cchBuffer As Long) As
Long

-------------------------------

Public Function GetShortFileName(ByVal FileName As String)
As String
    'converts a long file and path name to old DOS format
    'PARAMETERS
    '   FileName = the path or filename to convert
    'RETURNS
    '   String = the DOS compatible name for that particular
FileName

    Dim rc As Long
    Dim ShortPath As String
    Const PATH_LEN& = 164

    'get the short filename
    ShortPath = String$(PATH_LEN + 1, 0)
    rc = GetShortPathName(FileName, ShortPath, PATH_LEN)
    GetShortFileName = Left$(ShortPath, rc)

End Function

Jeff Hong YAN



Sun, 24 Oct 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Convert long filenames to short filenames

2. Convert Long Filenames to Short Filenames in VB4 16-Bit

3. Converting long filenames to short filenames in VB4.0 16-bit

4. Converting a Long Filename to Short.?

5. converting long filename paths to short

6. Converting long filenames to short

7. NEW: Converting long filenames to short

8. SHORT filename to LONG filename???

9. Short Filename to Long Filename ???

10. Long Filename -> Short Filename

11. SHORT filename to LONG filename???

12. Short filename to long filename

 

 
Powered by phpBB® Forum Software