Int fileCount=0, folderCount=0;
Long length=0;
The File folder=new File (" D: \ \ lalla ");
The File list=[] folder. ListFiles ();
For (the File File: list) {
{if (file. IsFile ())
FileCount++;
Length +=file. The length ();
} else {
FolderCount++;
}
}
But this can only access to the current directory for less than his subclass ah
CodePudding user response:
Daily topCodePudding user response:
Recursive...CodePudding user response:
Fine amount are stupid could sayCodePudding user response:
Recursive calls:Write a method, parameter is the folder path;
Methods internal access to all files, judgment, if it is a file, print (or other), if it is a folder, will continue to call this method,
CodePudding user response:
Well well know thank you