FileItemize

Returns a delimited list of files.

Syntax:

FileItemize (file-list)

Parameters:

(s) file-list a string containing a list of filenames, which may be wildcarded. Limited to 260 characters. (example: "*.jpg|*.bmp")

Returns:

(s)  a tab delimited list of files.

 

There are several variations we can use:

FileItemize("*.doc") ; a list of all files in the current directory with a DOC extension

FileItemize("*.com|*.exe") ; a list of all files in the current directory with a COM or EXE extension

FileItemize("*.*") ; a list of all files in the current directory.

FileItemize("*") ; a list of all files in the current directory.

FileItemize("c:\documents and settings\user\my documents\*.doc") ; a list of all files in the specified directory with a DOC extension

FileItemize("c:\command\*.com|d:\my app\*.exe") ; a list of all files in the specified directories with a COM or EXE extension

FileItemize("*.*") ; a list of all files in the specified directory.

 

This is especially useful in conjunction with the AskItemList function, which lets the user choose an item from such a delimited list.

Note: Some shell or file manager applications using the WIL Interpreter allow an empty string ("") to be used as the "file-list" parameter, in which case all files highlighted in the file display are returned. However, if there are any file names or wildcards in the string, all files matching the file names are returned, regardless of which ones are highlighted.

IntControl 91 controls the behavior of functions which take file masks, like FileItemize. By default, masks only match the long version of the file name. For example, if you do FileItemize("*.htm"), it will not match a file "home.html" whose short name is "home~1.htm". If you want it to match the short version of the file name as well, set "p1" to 1.

By default hidden and system files are ignored. IntControl 5 can be used to control whether or not hidden files are processed by this function.

This function supports extended-length path names.

Examples:

a = FileItemize("*.bak") ;all BAK files
b = FileItemize("*.arc|*.zip|*.lzh") ;compressed files
; Get which .INI file to edit
ifiles = FileItemize("c:\windows\*.ini")
ifile = AskItemlist(".INI Files", ifiles, @TAB, @UNSORTED, @SINGLE, @FALSE)
RunZoom("notepad", ifile)
Drop(ifiles, ifile)
See Also:

CurrentFile, DirItemize, AskItemList, FileInfoToArray, AskFileText, IntControl 5, IntControl 29, IntControl 91, WinItemize