Method to recursively delete any directory that has no files, my solution seems to work but trying to find ways it can break
<p>This method will delete any files and empty directories provided in the fileList. It seems to be working. I use recursion to delete the empty directories and i'm worried about cases that will create an infinite loop. Any thoughts or things to consider with this approach?</p>

<pre><code>public static void deleteFilesAndEmptyDirs(List&lt;File&gt; fileList) {
            boolean result = true;
            List&lt;File&gt; returnList = new LinkedList&lt;File&gt;();
            for (File file : fileList) {
                result = file.delete();
                if(result == false &amp;&amp; file.isDirectory()) {
                    returnList.add(file);
                }
            }

            if(returnList.size() &gt;= 1) {
                deleteFilesAndEmptyDirs(returnList);
            }
        }
</code></pre>
