/** * copies a folder from one location in a webdav server to another using the current domain * * @param domain The namespace used to identify the application domain (1st level directory) to * use * @param src The path relative to the domain for the source folder * @param des The path relative to the domain for the destination folder * @param overwrite If there is an existing folder, it will be overwritten if this parameter is * set to true * @return The complete path of the folder created or null if not created */ public String copyFolder(String src, String des, boolean overwrite) { String result = null; try { if (_isLocal) { File srcFile = new File(_rootFile.getCanonicalPath() + File.separatorChar + src); if (srcFile.isDirectory()) { File tmpFile = new File(_rootFile.getCanonicalPath() + File.separatorChar + des); result = tmpFile.getCanonicalPath(); if (tmpFile.mkdirs()) { File[] files = srcFile.listFiles(); for (int i = 0; i < files.length; i++) { String tmpPath = File.separatorChar + files[i].getName(); if (files[i].isDirectory()) { if (!copyFolder(src + tmpPath, des + tmpPath, overwrite) .equals(_rootFile.getCanonicalPath() + File.separatorChar + des + tmpPath)) result = null; } else if (files[i].isFile()) if (!copyFile(src + tmpPath, des + tmpPath, overwrite) .equals(_rootFile.getCanonicalPath() + File.separatorChar + des + tmpPath)) result = null; } } } } else { result = _remote.copyFolder(_domain, src, des, overwrite); } } catch (Exception ex) { ex.printStackTrace(); } return result; }