File.ListFiles Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ListFiles(IFilenameFilter) |
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. |
ListFiles(IFileFilter) |
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. |
ListFiles() |
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname. |
ListFiles(IFilenameFilter)
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
[Android.Runtime.Register("listFiles", "(Ljava/io/FilenameFilter;)[Ljava/io/File;", "GetListFiles_Ljava_io_FilenameFilter_Handler")]
public virtual Java.IO.File[]? ListFiles (Java.IO.IFilenameFilter? filter);
[<Android.Runtime.Register("listFiles", "(Ljava/io/FilenameFilter;)[Ljava/io/File;", "GetListFiles_Ljava_io_FilenameFilter_Handler")>]
abstract member ListFiles : Java.IO.IFilenameFilter -> Java.IO.File[]
override this.ListFiles : Java.IO.IFilenameFilter -> Java.IO.File[]
Parameters
- filter
- IFilenameFilter
A filename filter
Returns
An array of abstract pathnames denoting the files and
directories in the directory denoted by this abstract pathname.
The array will be empty if the directory is empty. Returns
null
if this abstract pathname does not denote a
directory, or if an I/O error occurs.
- Attributes
Remarks
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the #listFiles()
method, except that the pathnames in the returned array must satisfy the filter. If the given filter
is null
then all pathnames are accepted. Otherwise, a pathname satisfies the filter if and only if the value true
results when the FilenameFilter#accept FilenameFilter.accept(File, String)
method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.
Added in 1.2.
Java documentation for java.io.File.listFiles(java.io.FilenameFilter)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
ListFiles(IFileFilter)
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
[Android.Runtime.Register("listFiles", "(Ljava/io/FileFilter;)[Ljava/io/File;", "GetListFiles_Ljava_io_FileFilter_Handler")]
public virtual Java.IO.File[]? ListFiles (Java.IO.IFileFilter? filter);
[<Android.Runtime.Register("listFiles", "(Ljava/io/FileFilter;)[Ljava/io/File;", "GetListFiles_Ljava_io_FileFilter_Handler")>]
abstract member ListFiles : Java.IO.IFileFilter -> Java.IO.File[]
override this.ListFiles : Java.IO.IFileFilter -> Java.IO.File[]
Parameters
- filter
- IFileFilter
A file filter
Returns
An array of abstract pathnames denoting the files and
directories in the directory denoted by this abstract pathname.
The array will be empty if the directory is empty. Returns
null
if this abstract pathname does not denote a
directory, or if an I/O error occurs.
- Attributes
Remarks
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the #listFiles()
method, except that the pathnames in the returned array must satisfy the filter. If the given filter
is null
then all pathnames are accepted. Otherwise, a pathname satisfies the filter if and only if the value true
results when the FileFilter#accept FileFilter.accept(File)
method of the filter is invoked on the pathname.
Added in 1.2.
Java documentation for java.io.File.listFiles(java.io.FileFilter)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
ListFiles()
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.
[Android.Runtime.Register("listFiles", "()[Ljava/io/File;", "GetListFilesHandler")]
public virtual Java.IO.File[]? ListFiles ();
[<Android.Runtime.Register("listFiles", "()[Ljava/io/File;", "GetListFilesHandler")>]
abstract member ListFiles : unit -> Java.IO.File[]
override this.ListFiles : unit -> Java.IO.File[]
Returns
An array of abstract pathnames denoting the files and
directories in the directory denoted by this abstract pathname.
The array will be empty if the directory is empty. Returns
null
if this abstract pathname does not denote a
directory, or if an I/O error occurs.
- Attributes
Remarks
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.
If this abstract pathname does not denote a directory, then this method returns null
. Otherwise an array of File
objects is returned, one for each file or directory in the directory. Pathnames denoting the directory itself and the directory's parent directory are not included in the result. Each resulting abstract pathname is constructed from this abstract pathname using the #File(File, String) File(File, String)
constructor. Therefore if this pathname is absolute then each resulting pathname is absolute; if this pathname is relative then each resulting pathname will be relative to the same directory.
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
Note that the java.nio.file.Files
class defines the java.nio.file.Files#newDirectoryStream(Path) newDirectoryStream
method to open a directory and iterate over the names of the files in the directory. This may use less resources when working with very large directories.
Added in 1.2.
Java documentation for java.io.File.listFiles()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.