How to delete all the files in the folder INCLUDE the sub-folder?
<p>This is my code. But it only be able to delete the txt file in the current folder, not sub-folder.    </p>

<pre><code>import java2.org.apache.commons.io.filefilter.WildcardFileFilter;
    import java.io.*;
    public class DeleteSameType{
    public static void main(String []args){

        File dir = new File("user/document/test");
        FileFilter fileFilter = new WildcardFileFilter("*.txt");
        File[] files = dir.listFiles(fileFilter); 
        for(File f: files){
            f.delete();
        }

    }
}
</code></pre>

<p><a href="https://i.stack.imgur.com/CAIkc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CAIkc.png" alt="enter image description here"></a></p>