File Names: List Long file Names from Database List of short file names

File Names: List Long file Names from Database List of short file names

Post by Ben » Sat, 06 May 2006 21:58:41


Hi

We have a list of file paths and short file names in our database.

We need to loop through them all, picking up the long file name from the
file itself and check that the long file name does not include a "~"
character.

I have the short file name and path in a variable (eg
"c:\data\123442~1.doc") how can I get the long file name from this data.

Any advice would be much appreciated.

Thanks
B
 
 
 

File Names: List Long file Names from Database List of short file names

Post by jayelde » Sat, 06 May 2006 23:05:35

Good ol' Dir( ) from vb6 will do what you want.

Dim filename As String = "C:\somelo~1.txt"
Console.WriteLine(Dir(filename))
Console.ReadLine()
Exit Sub

^ Outputs 'somelongfilename.txt' to the console.

That's the quickest way I can think of. I looked at the System.IO.File
and although it accepts both long names and the 8dot3 file names, I
couldn't find a way to switch between the two.

John

 
 
 

File Names: List Long file Names from Database List of short file names

Post by Ben » Sun, 07 May 2006 00:06:59

Thanks John thats perfect!!

B