Java tutorial
//package com.java2s; import java.io.File; public class Main { private static File COPIED_FILE = null; public static boolean canPaste(File destDir) { if (getFileToPaste() == null) { return false; } if (getFileToPaste().isFile()) { return true; } try { if (destDir.getCanonicalPath().startsWith(COPIED_FILE.getCanonicalPath())) { return false; } else { return true; } } catch (Exception e) { return false; } } public static synchronized File getFileToPaste() { return COPIED_FILE; } }