[AccessD] File Created with wrong name

Reuben Cummings reuben at gfconsultants.com
Fri Jan 13 10:32:38 CST 2006


The file in question was emailed to me and that long name thing does not
work on it (is that possibly lost in the emailing).

More importantly, why did their system store the file this way?

If I ALWAYS run this GetLongFileName on the path and file I plan to FTP I
should always get the correct path.  Because if I pass the long name I
should get the long name, correct?

Reuben Cummings
GFC, LLC
812.523.1017


> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Reuben
> Cummings
> Sent: Friday, January 13, 2006 11:07 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] File Created with wrong name
>
>
> Gustav, do you mean that although the file name is chrtta~1.zip that the
> full name is still associated to it and can be found thru that second
> function you sent?
>
> I'm sure this is another one of those things I've missed out on by never
> taking computer classes of any type.
>
> Reuben Cummings
> GFC, LLC
> 812.523.1017
>
>
> > -----Original Message-----
> > From: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Gustav Brock
> > Sent: Friday, January 13, 2006 10:46 AM
> > To: accessd at databaseadvisors.com
> > Subject: Re: [AccessD] File Created with wrong name
> >
> >
> > Hi Reuben
> >
> > It's the short filename.
> >
> > You may convert to and from the short and long filename:
> >
> > <code>
> >
> > '
> >
> -------------------------------------------------------------------------
> > ' Declarations for GetShortFileName.
> >
> > Private Declare Function GetLongPathName Lib "kernel32" Alias
> > "GetLongPathNameA" ( _
> >   ByVal lpszShortPath As String, _
> >   ByVal lpszLongPath As String, _
> >   ByVal cchBuffer As Long) As Long
> >
> > 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 FullPath As String) As String
> >
> > 'PURPOSE: Returns DOS File Name (8.3 Format) Give
> > 'FullPath for long file name
> >
> > 'PARAMETERS: FullPath: Full Path of Original File
> >
> > 'RETURNS: 8.3 FileName, or "" if FullPath doesn't
> > '         exist or file fails for other reasons
> >
> > 'EXAMPLE:
> > 'Debug.Print _
> > '  GetShortFileName("C:\My Documents\My Very Long File Name.doc")
> >
> > 'If file exists, will display C:\MYDOCU~1\MYVERY~1.DOC
> > 'in the debug window
> >
> > Dim lAns As Long
> > Dim sAns As String
> > Dim iLen As Integer
> >
> > On Error Resume Next
> >
> > 'this function doesn't work if the file doesn't exist
> > '''If Dir(FullPath) = "" Then Exit Function
> >
> > sAns = Space(255)
> > lAns = GetShortPathName(FullPath, sAns, 255)
> > GetShortFileName = Left(sAns, lAns)
> >
> > End Function
> >
> > Public Function GetLongFileName(ByVal FullPath As String) As String
> >
> > 'PURPOSE:
> > ' Returns FullPath for short file name (8.3 Format)
> > ' Give long File Name
> >
> > 'PARAMETERS: FullPath: Full Path of Original File
> >
> > 'RETURNS: FileName, or "" if FullPath doesn't
> > '         exist or file fails for other reasons
> >
> > 'EXAMPLE:
> > 'Debug.Print _
> > '  GetShortFileName("C:\My Documents\My Very Long File Name.doc")
> >
> > 'If file exists, will display C:\MYDOCU~1\MYVERY~1.DOC
> > 'in the debug window
> >
> > Dim lAns As Long
> > Dim sAns As String
> > Dim iLen As Integer
> >
> > On Error Resume Next
> >
> > 'this function doesn't work if the file doesn't exist
> > '''If Dir(FullPath) = "" Then Exit Function
> >
> > sAns = Space(255)
> > lAns = GetLongPathName(FullPath, sAns, 255)
> > GetLongFileName = Left(sAns, lAns)
> >
> > End Function
> >
> > </code>
> >
> > /gustav
> >
> >
> > >>> reuben at gfconsultants.com 13-01-2006 16:25 >>>
> > I have a feature that allows a user to zip the data file or zip
> it and FTP
> > it to my web server.
> >
> > It has worked flawlessly until now...the reason is that the
> file name that
> > the zip file got saved to was not what it's supposed to be.  I need help
> > figuring out why the file name was incorrect.
> >
> > The data file (in this case) is named   chrttable.mdb
> >
> > I append some data from the app to create a unique file name.
> > The name ends
> > up being   chrttableAllenCounty01132006.zip
> >
> > The client's system produced a zip file named     chrtta~1.zip
> >
> > Why is the name trucnated and changed to chrtta~1.zip?
> >
> > Thanks.
> >
> > Reuben Cummings
> > GFC, LLC
> > 812.523.1017
> >
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
>
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>







More information about the AccessD mailing list