GetDirectory

The GetDirectory function returns a string vector with file names. If bRecurseSubDirs is TRUE (1) it returns also the file names found in sub-directories. The function does not return directory names.

svFileNames = GetDirectory(ssSearch)
svFileNames = GetDirectory(ssSearch, bRecurseSubDirs)
svFileNames = GetDirectory(ssSearch, bRecurseSubDirs, ssCallback)

Return Value

svFileNames is a string vector with complete file names. If the function could not find any files an empty string is returned (“”).

Parameters

ssSearch

The ssSearch parameter may use wildcards (* and ?). Example c:\*.xls.

bRecurseSubDirs

If bRecurseSubDirs is TRUE (1) a sub directory will be included in the search. Default value is FALSE (0).

ssCallback

Name of a Callback function. The function will be invoked for each file found. The callback function has three parameters:

my_dir_callback(bDir, ssFile, files)

bDir: TRUE (1) if the second paramter is a directory and otherwise FALSE (0).

ssFile: File of directory name.

files: An object created with obj_create to save the files. See example.

Example

The following call creates a string vector of all IPW files for the given directory

* GetDirectory("c:/programme/uniplot/samples/*.ipw", 1)
c:/programme/uniplot/samples/sample.ipw
c:/programme/uniplot/samples/template.ipw
c:/programme/uniplot/samples/automate/example.ipw
c:/programme/uniplot/samples/automate/vollast.ipw
def my_dir_callback(bDir, ssFile, files)
{
    if (bDir) {
        AppSetStatusBarText(ssFile);
    } else {
        files[ssFile] = 1;
    }
}
* GetDirectory("c:/programme/uniplot/samples/*.ipw", 1, "my_dir_callback")
c:/programme/uniplot/samples/sample.ipw
c:/programme/uniplot/samples/template.ipw
c:/programme/uniplot/samples/automate/example.ipw
c:/programme/uniplot/samples/automate/vollast.ipw

id-1233954