java2db

How to get all file names from a directory or folder in java



Use the method list() in java.io.File to get all file names from a directory  .The file names will be in the form of name and its extension (ie xxxxx.txt).

 

get all file names from a directory or folder in java  If the Abstract path name does not denotes a directory,this method will return null.
get all file names from a directory or folder in java  list() method returns a String array of all file names , not the abstract path.

 

Syntax:

String <objectName>[] = <fileObject>.list();

Example to get all file names :

Execution Result:

get all file names from a directory or folder in java It is  possible to get all the directory names that are resides in a Parent directory.




Related Posts :
what is directory and how to create distinguished name for LDAP
What is LDAP or Lightweight Directory Access Protocol
Get or Set Last Modified Date and Time for a File or directory in java
How to find all hidden files in a folder or directory in java
How to create a temp file in default or specified directory
How to delete a file or folder from directory in java
How to rename a file from a directory or folder in java
   [will not be published]



^ <