title: Can extract file but can't delete file
body: <p>Below is my JAVA Code use for extract and delete file. The problem is when I successfully extract the zip file, then when I delete it. It just won't works.</p>
  
  <p>Note:<br>
  local = my local folder<br>
  zipFile = my zip file name<br>
  The zip and txt file is download by java program from ftp server<br>
  I can manually delete from my explorer, except my program</p>
  
  <pre><code>public static void extract(File local, String zipFile) {
  
      try {
          // destination folder to extract the contents         
          String destName = local + "";      
  
          byte[] buf = new byte[1024];
          ZipInputStream zis = null;
          ZipEntry zipentry;
          zis = new ZipInputStream(new FileInputStream(local + "/" + zipFile));
          zipentry = zis.getNextEntry();
  
          while (zipentry != null) {
              // for each entry to be extracted
              String entryName = zipentry.getName();
  
              int n;
              FileOutputStream fos3;
              File newFile = new File(entryName);
  
              String directory = "/tmp/";
  
              // to creating the parent directories
              if (directory == null) {
                  if (newFile.isDirectory()){
                      break;
                  }
              } else {
                  new File(destName+directory).mkdirs();
              }
  
              if(!zipentry.isDirectory()){ 
                  System.out.println("File to be extracted....."+ entryName);
                  fos3 = new FileOutputStream(destName + directory  + entryName);
  
                  while ((n = zis.read(buf, 0, 1024)) &gt; -1){
                      fos3.write(buf, 0, n);
                  }
                  fos3.close();
              }
  
              zis.closeEntry();
              zipentry = zis.getNextEntry();
          }// while
          zis.close();
  
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  public static void delete(File file) {
  
      // Check if file is directory/folder
      if(file.isDirectory()) {
          // Get all files in the folder
          File[] files=file.listFiles();
  
          for(int i=0;i&lt;files.length;i++) {
  
              // Delete each file in the folder
              delete(files[i]);
              System.out.println("Successfully delete file --&gt; " + files[i]);
          }
  
          // Delete the folder
          file.delete();
      }else {
          // Delete the file if it is not a folder
          file.delete();
          System.out.println("Successfully delete file --&gt; " + file);
      }
  }
  public static void main(String[] args) {
  //extract
  extract(local, zipFile);
  
  File ftpClientZip = new File(local + "/" + zipFile);
  File ftpClientMD5 = new File(local + "/" + txtFile);
  
  delete(ftpClientZip);
  delete(ftpClientMD5);
  }
  </code></pre>