Board index » delphi » Converting Long Filenames to short

Converting Long Filenames to short

Quote
Kenneth Boldt wrote:

> Hi!

> I am writing a FrontEnd for a DOS program, and I am having a little
> problem with long filenames vs old dos filenames.

> how can i convert a path from c:\programs\Something Long\Testing.exe

> to something an old DOS program can figure out ???

> I want the result to be something like
> c:\programs\someth~1\Testing.exe

> --
> Kenneth Boldt
> Kenneth_Bo...@bigfoot.com
> http://home3.inet.tele.dk/boldt
> ICQ: 860119

The short name can be found in the
TSearchRec.FindData.cAlternateFileName field. or GetShortPathName

Hope that helps
Rkr
--

          \|||/
          /'^'\
         ( 0 0 )
-----oOOO--(_)--OOOo----------
Reid Roman
E-Mail : rkroman (at) pacbell (dot) net
Delphi Enthusiast, Hobbiest ..
TVisualBasic:=class(None);
U.S.A
------------------------------

 

Re:Converting Long Filenames to short


On Wed, 29 Oct 1997 05:38:22 -0800, Reid Roman <rkro...@pacbell.net>
wrote:

Quote
>The short name can be found in the
>TSearchRec.FindData.cAlternateFileName field. or GetShortPathName

Could You, or anyone else please give an example?
--
Kenneth Boldt
Kenneth_Bo...@bigfoot.com
http://home3.inet.tele.dk/boldt
ICQ: 860119

Re:Converting Long Filenames to short


Hi, take at my sample source code:

http://www.preview.org/e/q2003.shtml

It contains 2 functions:
    function GetShortName(sLongName : string) : string;
and
    function GetLongName(sShortName : string) : string;

--
greetings,
Peter Tiemann
Delphi Tips and Tricks: http://www.preview.org/e/help.shtml
Check out the localizing component TMultiLang.. http://www.preview.org/

Quote
Kenneth Boldt wrote in message <3456fd93.3008...@news.inet.tele.dk>...

[..]
Quote
>I am writing a FrontEnd for a DOS program, and I am having a little
>problem with long filenames vs old dos filenames.

[..]

Re:Converting Long Filenames to short


Quote
Kenneth Boldt wrote:

> On Wed, 29 Oct 1997 05:38:22 -0800, Reid Roman <rkro...@pacbell.net>
> wrote:

> >The short name can be found in the
> >TSearchRec.FindData.cAlternateFileName field. or GetShortPathName

> Could You, or anyone else please give an example?
> --
> Kenneth Boldt
> Kenneth_Bo...@bigfoot.com
> http://home3.inet.tele.dk/boldt
> ICQ: 860119

I captured this info from :Jani J?rvinen / ja...@dystopia.fi
from these forums at an earlier time..

Quote
He wrote:

Use the FindFirstFile Windows API function to "find" the file. Pass in
the full long filename with path information, and then examine the
returned WIN32_FIND_DATE structure. The cAlternateFileName member is the
name of the file in the 8.3 format.

For the path part of the filename, use the GetShortPathName API
function.

Also:

The FileUtil.Pas unit in RxLib contains such a function.

http://rx.demo.ru/

Hope that helps!

Rkr
--

          \|||/
          /'^'\
         ( 0 0 )
-----oOOO--(_)--OOOo----------
Reid Roman
E-Mail : rkroman (at) pacbell (dot) net
Delphi Enthusiast, Hobbiest ..
TVisualBasic:=class(None);
U.S.A
------------------------------

Re:Converting Long Filenames to short


Hi!

I am writing a FrontEnd for a DOS program, and I am having a little
problem with long filenames vs old dos filenames.

how can i convert a path from c:\programs\Something Long\Testing.exe

to something an old DOS program can figure out ???

I want the result to be something like
c:\programs\someth~1\Testing.exe

--
Kenneth Boldt
Kenneth_Bo...@bigfoot.com
http://home3.inet.tele.dk/boldt
ICQ: 860119

Re:Converting Long Filenames to short


On Wed, 29 Oct 1997 15:11:11 -0800, "Peter Tiemann"

Quote
<pe...@preview.org> wrote:
>Hi, take at my sample source code:

>http://www.preview.org/e/q2003.shtml

>It contains 2 functions:
>    function GetShortName(sLongName : string) : string;
>and
>    function GetLongName(sShortName : string) : string;

Great!!! That's just what I needed, thanks to You and Reid Roman for
helping me out. I Appreciate it.

--
Kenneth Boldt
Kenneth_Bo...@bigfoot.com
http://home3.inet.tele.dk/boldt
ICQ: 860119

Other Threads