[Email protected] SVN submission, the empty directory will appear as follows
Svn:E200015:Empty directories is not supported: {PATH}
Solution: Add files in an empty directory so that they meet the criteria
Written here in the Java language, other languages are handled in a similar way
Not much to say, directly on the code
Import Java.io.BufferedWriter;
Import Java.io.File;
Import Java.io.FileWriter;
Import java.io.IOException;
Import Java.util.Scanner;
public class Dealemptyfolder {
public static void Main (string[] args) {
String PATH = "";
System.out.print ("Please input folder path:");
Scanner scan = new Scanner (system.in);
PATH = Scan.nextline (); Read-in File path
File root = new file (PATH);
Dealemptyfolder (root);
System.out.println ("End.");
}
Traverse Folder
private static void Dealemptyfolder (File root) {
TODO auto-generated Method Stub
file[] fs = Root.listfiles ();
for (int i = 0; i < fs.length; i++) {
System.out.println (Fs[i].getabsolutepath ());
if (Fs[i].isdirectory () && fs[i].listfiles (). length > 0) {
Dealemptyfolder (Fs[i]);
}else if (fs[i].isdirectory () && fs[i].listfiles (). Length = = 0) {
try {
Writetxt (Fs[i].getabsolutepath ()); Empty folder Write
} catch (IOException e) {
TODO auto-generated Catch block
E.printstacktrace ();
}
}
}
}
File Write
private static void Writetxt (String absolutepath) throws IOException {
TODO auto-generated Method Stub
String str = "This folder is Empty."; Write content
File NewFile = new file (Absolutepath + "/readme.txt");
if (!newfile.exists ()) {
Newfile.createnewfile ();
}
FileWriter FW = new FileWriter (Newfile.getname (), true);
BufferedWriter bw = new BufferedWriter (FW);
Bw.write (str);
Bw.close ();
}
}
Java Solution [email protected] SVN empty directory