Check for Long File Names in Windows 3.x w/ Visual FoxPro

ID: Q131407

3.00 WINDOWS

The information in this article applies to:

  • Microsoft Visual FoxPro for Windows, version 3.0

SUMMARY

When you connect to a Windows NT server and try to access a file that has a long file name, Windows version 3.x uses the PC-NFS standards to truncate the name of the file to eight characters placing tilde (~) in the seventh position followed by a number.

Developers can use the generic code listed in this article to make sure no long file names exist on the server.

MORE INFORMATION

NOTE: The following code returns TRUE (.T.) if no long file names exist on the default directory. Otherwise, it returns FALSE (.F.).

   SET DEFAULT TO <NET DRIVE>:<PATH>
   X=CREATEOBJECT("CustTrackLongName")
   Do While (X.FINDLONG())
     .
     .
   <REST OF CODE TO MODIFY FILES>
     .
     .
   ENDDO

   *********************************************
   *   This is a class that will track         *
   *   any long file name  in the default      *
   *   directory.                            *
   *   The class define is a property that is  *
   *   set to true if no long file names       *
   *   exist and false if a long file name     *
   *   does exist. In addition, the class      *
   *   defines a member(method) called         *
   *   FindLong that will check to see         *
   *   if a long filename was returned by the  *
   *   ADIR function.                        *
   *                                           *
   * Algorithm:                                *
   *      Input/Parameters:    NONE            *
   *      Output/Return Value: .T. No LFN      *
   *                           .F. LFN         *
   *LFN=Long File Name                         *
   *********************************************
   DEFINE CLASS CustTrackLongName AS Custom
     Flag=.T. &&New property
     PROCEDURE FindLong
        iDirLength=ADIR(aMyarray)
        DIMENSION aiNewarray(iDirLength)
        FOR i=1 TO iDirLength
           aiNewarray(i)=aMyarray(i,1)
           Temp=aiNewarray(i)
           TempLen=LEN(ALLTRIM(TEMP))
           cOneChar=SUBSTR(Temp,7,1)  && read the 7th position
                                      && for ~
                   IF cOneChar="~"
                         This.Flag=.F.
                         EXIT
                   ENDIF
        NEXT I
        IF This.Flag=.F.
          RETURN .F.
        Else
          Return .T.
        ENDIF
     ENDPROC
   ENDDEFINE

Additional reference words: 3.00 VFoxWin KBCategory: KBSubcategory: FxnetworkWinnt
Keywords          : kbcode kbnetwork FxnetworkWinnt 
Version           : 3.00
Platform          : WINDOWS


Last Reviewed: May 22, 1998
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.