private void copyDirectory(File source,File dest) throws IOException {
  for (  File f : source.listFiles()) {
    File sourceFile=new File(source,f.getName());
    File destFile=new File(dest,f.getName());
    if (f.isDirectory()) {
      destFile.mkdirs();
      copyDirectory(sourceFile,destFile);
    }
 else     copyFile(sourceFile,destFile);
  }
}

private void copyDirectory ( File source , File dest ) throws IOException { for ( File f : source . listFiles ( ) ) { File sourceFile = new File ( source , f . getName ( ) ) ; File destFile = new File ( dest , f . getName ( ) ) ; if ( f . isDirectory ( ) ) { destFile . mkdirs ( ) ; copyDirectory ( sourceFile , destFile ) ; } else copyFile ( sourceFile , destFile ) ; } }
copy an entire directory from one location to another . this is used in file dumping .
