public static void copy ( final File src , final File dest ) throws IOException { if ( src . isDirectory ( ) ) { copyDir ( src , dest ) ; return ; } if ( dest . isDirectory ( ) ) { copyFileToDir ( src , dest ) ; return ; } copyFile ( src , dest ) ; }
Smart copy . If source is a directory copy it to destination . Otherwise if destination is directory copy source file to it . Otherwise try to copy source file to destination file .