getFileNamesRev()
Reverse of the function getFileNames()
.
Returns a list of all file or directory names in the directory dir that do NOT match the pattern pattern.
Synopsis
dyn_string getFileNamesRev([string dir = "." [, string pattern = "*"] [, int
filter = FILTER_FILES]]);
Parameters
Parameter | Description |
---|---|
dir | Directory, for example, ".", "..", "/usr", PROJ_PATH, "C://" |
pattern | Pattern, for example, "*", "*.bak" or "?oo?.i*" |
filter | Filter can be a either FILTER_FILES (files) or FILTER_DIRS (directories) or a combination of FILTER_FILES and FILTER_DIRS. |
Return value
The function returns a list of file or directory names
Description
Returns a list of all file or directory names in the directory dir that do NOT match the pattern pattern.
Example
The following example returns all the files that do not end in TMP:
main()
{
int i;
dyn_string t = getFileNamesRev("C:/TEMP", "*.tmp");
// Output:
for (i=1; i<=dynlen(t); i++) DebugN(i, "", t[i]);
}
The following example returns all directories that do not end in "pictures":
main()
{
int i;
dyn_string t = getFileNamesRev("C:/Siemens/Automation/WinCC_OA
/3.20","pictures",FILTER_DIRS);
// Output:
for(i=1;i<=dynlen(t);i++) DebugN(i," ",t[i]);
}
Assignment
File function
Availability
CTRL