Board index » delphi » Converting long file names to short ones

Converting long file names to short ones

In one proceduce I'm spooling the user input to another (commandline dos
based) program. User may select the input file which is passed, along with
the path to the file, to this external program. However, the external
program doesn't cope with lon file names, so how do I convert the long
file names (and paths) to short ones?

Juha

 

Re:Converting long file names to short ones


In article <6bsi8q$...@vesuri.Helsinki.FI>, sahar...@cc.helsinki.fi (Juha

Quote
Saharinen) writes:
>In one proceduce I'm spooling the user input to another (commandline dos
>based) program. User may select the input file which is passed, along with
>the path to the file, to this external program. However, the external
>program doesn't cope with lon file names, so how do I convert the long
>file names (and paths) to short ones?

You don't want to convert a long filename to an alias (a short filename), you
want to find the alias filename corresponding to the long filename for a
certain file.

You can do this with FindFirstFile, entering the long filename in the cFileName
field of the WIN32_FIND_DATA structure, and recovering the alias from the
cAlternativeFileName field of the same structure after the call to
FindFirstFile.

Hope this helps

Alan Lloyd
alangll...@aol.com

Other Threads