PC Review


Reply
Thread Tools Rate Thread

Convert Long File Name to Short File Name

 
 
=?Utf-8?B?Um9iZXJ0X0xfUm9zcw==?=
Guest
Posts: n/a
 
      8th Dec 2006
OK, he're's the dilemma.

I have two lists of files I've imported. One has the file names/paths in
long format that contains the path, name, size, last accessed, etc.

The other list has them in DOS format wiht name, path size, last accessed
and owner.

I need to get the file name strings in the same format so I can compare the
two and put the owners to the long file names.

Is there some magical way to put these lists in Excel and somehow convert
the long file paths/names to short file paths/names? It's the only way I can
think of to get the files in sync. I thought of converting from short to
long, but my problem is I may have three files with a short name of
OGS101~1.TXT that have three different owners - how would I know what one is
~1, ~2 or ~3 when they are all the same size/file date?

I found some scripts that take out the spaces, but I don't know how the
short file name handles special characters and how it truncates to ~2, ~3,
etc.

Any help would be greatly appreciated!
 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      8th Dec 2006
Robert,
You can use the GetShortPathName API call, instead of trying to do it
yourself.
Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA"
(ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal
cchBuffer As Long) As Long
See here for an example :
http://vbnet.mvps.org/code/hooks/fil...dlghookadv.htm

NickHK

"Robert_L_Ross" <(E-Mail Removed)> wrote in message
news:68C68222-748F-4A9E-9538-(E-Mail Removed)...
> OK, he're's the dilemma.
>
> I have two lists of files I've imported. One has the file names/paths in
> long format that contains the path, name, size, last accessed, etc.
>
> The other list has them in DOS format wiht name, path size, last accessed
> and owner.
>
> I need to get the file name strings in the same format so I can compare

the
> two and put the owners to the long file names.
>
> Is there some magical way to put these lists in Excel and somehow convert
> the long file paths/names to short file paths/names? It's the only way I

can
> think of to get the files in sync. I thought of converting from short to
> long, but my problem is I may have three files with a short name of
> OGS101~1.TXT that have three different owners - how would I know what one

is
> ~1, ~2 or ~3 when they are all the same size/file date?
>
> I found some scripts that take out the spaces, but I don't know how the
> short file name handles special characters and how it truncates to ~2, ~3,
> etc.
>
> Any help would be greatly appreciated!



 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      8th Dec 2006
Robert,
And here's an example cribbed from the API-Guide:

Private Declare Function GetShortPathName Lib "kernel32" Alias
"GetShortPathNameA" _
(ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal lBuffer As Long) _
As Long

Public Function GetShortPath(strFileName As String) As String
'KPD-Team 1999
'URL: http://www.allapi.net/
Dim lngRes As Long, strPath As String
'Create a buffer
strPath = String$(165, 0)
'retrieve the short pathname
lngRes = GetShortPathName(strFileName, strPath, 164)
'remove all unnecessary chr$(0)'s
GetShortPath = Left$(strPath, lngRes)
End Function

NickHK


"NickHK" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Robert,
> You can use the GetShortPathName API call, instead of trying to do it
> yourself.
> Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA"
> (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal
> cchBuffer As Long) As Long
> See here for an example :
> http://vbnet.mvps.org/code/hooks/fil...dlghookadv.htm
>
> NickHK
>
> "Robert_L_Ross" <(E-Mail Removed)> wrote in message
> news:68C68222-748F-4A9E-9538-(E-Mail Removed)...
> > OK, he're's the dilemma.
> >
> > I have two lists of files I've imported. One has the file names/paths

in
> > long format that contains the path, name, size, last accessed, etc.
> >
> > The other list has them in DOS format wiht name, path size, last

accessed
> > and owner.
> >
> > I need to get the file name strings in the same format so I can compare

> the
> > two and put the owners to the long file names.
> >
> > Is there some magical way to put these lists in Excel and somehow

convert
> > the long file paths/names to short file paths/names? It's the only way

I
> can
> > think of to get the files in sync. I thought of converting from short

to
> > long, but my problem is I may have three files with a short name of
> > OGS101~1.TXT that have three different owners - how would I know what

one
> is
> > ~1, ~2 or ~3 when they are all the same size/file date?
> >
> > I found some scripts that take out the spaces, but I don't know how the
> > short file name handles special characters and how it truncates to ~2,

~3,
> > etc.
> >
> > Any help would be greatly appreciated!

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Long file name to Short file name =?Utf-8?B?Um9iZXJ0X0xfUm9zcw==?= Microsoft Access VBA Modules 1 8th Dec 2006 12:53 AM
I can't save long file names, only short one, how can I do this? =?Utf-8?B?c2hvcnQgZmlsZSBuYW1lcw==?= Microsoft Excel Misc 0 3rd Jan 2006 05:13 PM
Short Windows file name (8 char) vs long one Gilles A. Microsoft Windows 2000 Registry 1 25th Mar 2004 03:48 AM
Short Windows file name (8 char) vs long one Gilles A. Microsoft Windows 2000 Registry Archive 2 25th Mar 2004 03:48 AM
Short Windows file name (8 char) vs long one Gilles A. Microsoft Windows 2000 Registry Archive 0 24th Mar 2004 09:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:45 PM.