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

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -