Many of the ways in which Java operates on a directory are the same as in the previous file.
Java.io.File file = new file ("D:\1\2\3\4");
1. Creating a directory recursively
File.mkdirs ();
2. Deleting a directory
File.isdirectory (); Interpreting whether the table of contents
File.list (); Returns a file name without a full directory
File.delete (); Delete
3. Is the empty
File.list () > 0//Directory not empty
File.getpath (); Directory path
4. Determine if the directory is hidden
File.ishidden (); return type is Boolean
5. Directory hierarchy
File.getname (); Returns the name of the path name of the last name of the sequence
File.list (); Returns a file name without a full path
File.listfiles (); Returns the file name with the full path
6. Get the last modification time of the catalog
File.lastmodified ();
7. Get the parent directory
File.getparent ();
8. Get the Directory size
Org.apache.commons.io.FileUtils.sizeOfDirectory (file);
9. Get the current working directory
System.getproperty ("Uset.txt");
10. Show root directory
File.listroots ();
Java Basics Series-Directory operations