Here you can find the source of checkDirCopy(File srcDir, File destDir)
private static void checkDirCopy(File srcDir, File destDir) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; public class Main { private static void checkDirCopy(File srcDir, File destDir) throws IOException { if (!srcDir.exists()) { throw new FileNotFoundException("Source '" + srcDir + "' does not exist."); }/*from ww w . j av a 2 s . c o m*/ if (!srcDir.isDirectory()) { throw new IOException("Source '" + srcDir + "' is not a directory."); } if (equals(srcDir, destDir)) { throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are the same."); } } /** * Checks if two files points to the same file. */ public static boolean equals(String file1, String file2) { return equals(new File(file1), new File(file2)); } /** * Checks if two files points to the same file. */ public static boolean equals(File file1, File file2) { try { file1 = file1.getCanonicalFile(); file2 = file2.getCanonicalFile(); } catch (IOException ioex) { return false; } return file1.equals(file2); } }