title: How to move specific files to new folder in java
body: <p>I want to move 4 files having file name as FGA to new folder</p>
  
  <pre><code>public void delete(String DirectoryName) {
           String dir = DirectoryName;
  
           File file = new File(dir);
  
           boolean recursive = true;
  
           Collection files = FileUtils.listFiles(file, null, recursive);
  
           for (Iterator iterator = files.iterator(); iterator.hasNext();) {
                  File file1 = (File) iterator.next();
                  if (file1.getName().contains("FGA_"))
                        file1.delete();
                  else if (file1.getName().contains("UPP_"))
                        file1.delete();
  
           }
           System.out.println("Files deleted");
     }
  </code></pre>