Java Learning at a glance--file class file processing
File Class (Java.io.File)
constructor function:
File (String Path)
File (String parent,string Child)
File (file parent,string child)
To create a file:
Boolean createnewfile ();
To create a folder:
Boolean mkdir (); Used to create a layer of undefined folders Boolean mkdirs ();
Used to create multi-level undefined folders, equivalent to multiple mkdir ()
Delete files/folders:
Boolean delete ();
Note: If a folder is not empty, you cannot use. Delete () to delete the folder
Rename:
Boolean rename (File FILE0); [File.rename (file FILE0);]
Note: If the same path is renamed, the different paths are renamed plus cut
Judging function:
Boolean canRead (); Whether it is readable
Boolean canWrite (); Whether it can be written
Boolean Ishidden (); Whether to hide
Boolean isdirectory; Whether it is a folder
Boolean isfile (); Whether it is a file
Boolean exists (); Whether there is
Get Features:
String GetAbsolutePath (); Absolute path
String GetPath (); Relative path
String GetName (); Get file name
Long length (); Get length size
Long LastModified (); Gets the millisecond value of the last modified time
Get a list of files:
String[] List (); Gets an array of all file or folder names (strings) in the specified directory
File[] ListFile (); Gets an array of all files or folders in the specified directory
Java Learning at a glance--file class file processing