code: public static int copy( File sourceFileOrDirectory,
                              File destinationFileOrDirectory,
                              FilenameFilter exclusionFilter ) throws IOException {
          if (exclusionFilter == null) exclusionFilter = ACCEPT_ALL;
          int numberOfFilesCopied = 0;
          if (sourceFileOrDirectory.isDirectory()) {
              destinationFileOrDirectory.mkdirs();
              String list[] = sourceFileOrDirectory.list(exclusionFilter);
  
              for (int i = 0; i < list.length; i++) {
                  String dest1 = destinationFileOrDirectory.getPath() + File.separator + list[i];
                  String src1 = sourceFileOrDirectory.getPath() + File.separator + list[i];
  
                  numberOfFilesCopied += copy(new File(src1), new File(dest1), exclusionFilter);
              }
          } else {
              try (FileInputStream fis = new FileInputStream(sourceFileOrDirectory);
                   BufferedInputStream bis = new BufferedInputStream(fis);
                   FileOutputStream fos = new FileOutputStream(destinationFileOrDirectory);
                   BufferedOutputStream bos = new BufferedOutputStream(fos)) {
                  int c;
                  while ((c = bis.read()) >= 0) {
                      bos.write(c);
                  }
              }
              numberOfFilesCopied++;
          }
          return numberOfFilesCopied;
      }
docs: Copy the source file system structure into the supplied target location. If the source is a file, the destination will be
  created as a file; if the source is a directory, the destination will be created as a directory.
  
  @param sourceFileOrDirectory the file or directory whose contents are to be copied into the target location
  @param destinationFileOrDirectory the location where the copy is to be placed; does not need to exist, but if it does its
  type must match that of <code>src</code>
  @param exclusionFilter a filter that matches files or folders that should _not_ be copied; null indicates that all files
  and folders should be copied
  @return the number of files (not directories) that were copied
  @throws IllegalArgumentException if the <code>src</code> or <code>dest</code> references are null
  @throws IOException