/ / =========================================================================================================================================================================================== ======
/ / Implement a static method to copy all the contents below the specified folder below to the target folder
/ / =========================================================================================================================================================================================== ======
Public Static Void Copydir (String Srcpath)
{
/ / Check if the target directory ends with directory segmentation characters if not added
IF (aimpath [aimpath.length-1]! = path.directoryseparatorchar)
Aimpath = path.directoryseparatorchar;
/ / Judgment if the target directory exists if there is no existence, new
IF (! Directory.exists (aimpath)) Directory.createdIRectory (AIMPATH);
/ / Get a list of files of the source, which is an array containing files and directory paths.
// If you point to the file under the COPY target file without including a directory, please use the following method
// String [] filelist = Directory.getFiles (srcpath);
String [] filelist = Directory.GetFileSystemEntries (srcpath);
// Traverse all files and directories
FOREACH (String File in filelist)
{
// Before the directory processing, if there is this directory, recursively copy the file below this directory.
IF (Directory.exists (file))
CopyDir (File, Aimpath path.getFileName (file));
/ / Otherwise directly copy file
Else
File.copy (File, Aimpath Path.GetFileName (file), true);
}
}