CT_RESTFSEEK

 RESTFSEEK()
 Restores the FILESEEK environment

 Syntax

     RESTFSEEK(<cFileSeekEnvironment>) --> cNull

 Argument

     <cFileSeekEnvironment>  Designates a string that contains the
     FILESEEK() environment, which was passed by SAVEFSEEK().

 Returns

     RESTFSEEK() always returns a null string.

 Description

     RESTFSEEK() restores a saved FILESEEK() environment.  Use both of these
     functions to run through subdirectories recursively.

 Example

     The following small program shows all the files in all directories of
     the current drive, from the root.  The GETFILES procedure can be called
     recursively:

     DO GetFiles WITH "\"                  // Starts with root directory
     RETURN

     * ----------------------------------------
     PROCEDURE GetFiles(cSearchPath)
     PRIVATE cSeekEnv                      // Picks up SEEK environment
        ?                                  // Empty line for new dir.
     * All files, all attributes
     cFile  := FILESEEK(cSearchPath + "*.*", 63)

     DO WHILE .NOT. EMPTY(cFile)

        IF cFile <> "."                    // ".." and "." are dummys
           IF ISBIT(FILEATTR(), 5)         // Subdirectory?
              cSeekEnv := SAVEFSEEK()      // Save environment
              * Recursive call with extended path!
              DO GetFiles WITH cSearchPath + cFile + "\"
              RESTFSEEK(cSeekEnv)          // Restore environment
           ELSE
              ? cSearchPath + cFile
           ENDIF
        ENDIF
        cFile := FILESEEK()                // Next file
     ENDDO

     RETURN

See Also: FILESEEK() SAVEFSEEK()

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.