java - Force Delete all files from a folder -
I am using a specific code to delete files from a folder but it is proving to be very problematic because perhaps I forgot to turn off an InputStream or two. My such code is so big that I can not see all the inputstream that I have not stopped. Is there a way to delete files or whether there is an open InputStream or not?
This is the code I am using;
file = new file ("C: ABC details / last"); File [] finlist = fin.listFiles (); {If (finlist [n] .isFile ()) {System.gc (); for {int n = 0; n & lt; phenist. Length; n ++}; Thread.Sleep (2000); Finlist [n] .delete (); }} I have edited the code. This version works.
There is no input stream example in the provided piece of code.
Do not write too many unauthorized IO codes, please take a look at the project. Especially in class, for the removal of the file.
Your code can look like this:
FileFin = New file ("C: ABC for details / last"; (File file: fin.listFiles () } {FileDeleteStrategy.FORCE.delete (File);}
Comments
Post a Comment