java - Clear folder - delete files in folder - J2ME -


i trying clear files in folder using j2me. how do that?

since using j2me, java.io.file class not available you.

so assuming using fileconnector optional package (fcop).

take @ javadocs javax.microedition.io.file.fileconnection, , should able figure out details.

i'm not j2me expert, think code this:

fileconnection fconn = (fileconnection) connector.open("file:///somedirectory"); enumeration en = fconn.list(); while (en.hasmoreelements()) {     string name = en.nextelement();     fileconnection tmp = (fileconnection) connector.open(         "file:///somedirectory/" + name);     tmp.delete();     tmp.close(); } 

exception handling, proper resource handling (using finally) left exercise reader :-)


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -