Example usage for org.apache.commons.io FileUtils copyDirectoryToDirectory

List of usage examples for org.apache.commons.io FileUtils copyDirectoryToDirectory

Introduction

In this page you can find the example usage for org.apache.commons.io FileUtils copyDirectoryToDirectory.

Prototype

public static void copyDirectoryToDirectory(File srcDir, File destDir) throws IOException 

Source Link

Document

Copies a directory to within another directory preserving the file dates.

Usage

From source file:de.uzk.hki.da.sb.Cli.java

/**
 * Copies the files listed in a SIP list to a single directory
 * //from ww  w .j  a  v  a  2  s  . c  om
 * @param fileListFile The SIP list file
 * @return The path to the directory containing the files
 */
private String copySipListContentToFolder(File sipListFile) {

    CliProgressManager progressManager = new CliProgressManager();

    String tempFolderName = getTempFolderName();

    XMLReader xmlReader = null;
    SAXParserFactory spf = SAXParserFactory.newInstance();
    try {
        xmlReader = spf.newSAXParser().getXMLReader();
    } catch (Exception e) {
        logger.log("ERROR: Failed to create SAX parser", e);
        System.out.println("Fehler beim Einlesen der SIP-Liste: SAX-Parser konnte nicht erstellt werden.");
        return "";
    }
    xmlReader.setErrorHandler(new ErrorHandler() {

        @Override
        public void error(SAXParseException e) throws SAXException {
            throw new SAXException("Beim Einlesen der SIP-Liste ist ein Fehler aufgetreten.", e);
        }

        @Override
        public void fatalError(SAXParseException e) throws SAXException {
            throw new SAXException("Beim Einlesen der SIP-Liste ist ein schwerer Fehler aufgetreten.", e);
        }

        @Override
        public void warning(SAXParseException e) throws SAXException {
            logger.log("WARNING: Warning while parsing siplist", e);
            System.out.println("\nWarnung:\n" + e.getMessage());
        }
    });

    InputStream inputStream;
    try {
        inputStream = new FileInputStream(sipListFile);

        Reader reader = new InputStreamReader(inputStream, "UTF-8");
        Builder parser = new Builder(xmlReader);
        Document doc = parser.build(reader);
        reader.close();

        Element root = doc.getRootElement();
        Elements sipElements = root.getChildElements("sip");

        long files = 0;
        for (int i = 0; i < sipElements.size(); i++) {
            Elements fileElements = sipElements.get(i).getChildElements("file");
            if (fileElements != null)
                files += fileElements.size();
        }
        progressManager.setTotalSize(files);

        for (int i = 0; i < sipElements.size(); i++) {
            Element sipElement = sipElements.get(i);
            String sipName = sipElement.getAttributeValue("name");

            File tempDirectory = new File(tempFolderName + File.separator + sipName);
            if (tempDirectory.exists()) {
                FileUtils.deleteQuietly(new File(tempFolderName));
                System.out.println("\nDie SIP-Liste enthlt mehrere SIPs mit dem Namen " + sipName + ". "
                        + "Bitte vergeben Sie fr jedes SIP einen eigenen Namen.");
                return "";
            }
            tempDirectory.mkdirs();

            Elements fileElements = sipElement.getChildElements("file");

            for (int j = 0; j < fileElements.size(); j++) {
                Element fileElement = fileElements.get(j);
                String filepath = fileElement.getValue();

                File file = new File(filepath);
                if (!file.exists()) {
                    logger.log("ERROR: File " + file.getAbsolutePath() + " is referenced in siplist, "
                            + "but does not exist");
                    System.out.println("\nDie in der SIP-Liste angegebene Datei " + file.getAbsolutePath()
                            + " existiert nicht.");
                    FileUtils.deleteQuietly(new File(tempFolderName));
                    return "";
                }

                try {
                    if (file.isDirectory())
                        FileUtils.copyDirectoryToDirectory(file, tempDirectory);
                    else
                        FileUtils.copyFileToDirectory(file, tempDirectory);
                    progressManager.copyFilesFromListProgress();
                } catch (IOException e) {
                    logger.log("ERROR: Failed to copy file " + file.getAbsolutePath() + " to folder "
                            + tempDirectory.getAbsolutePath(), e);
                    System.out.println("\nDie in der SIP-Liste angegebene Datei " + file.getAbsolutePath()
                            + " konnte nicht kopiert werden.");
                    FileUtils.deleteQuietly(new File(tempFolderName));
                    return "";
                }
            }
        }
    } catch (Exception e) {
        logger.log("ERROR: Failed to read siplist " + sipListFile.getAbsolutePath(), e);
        System.out.println("\nBeim Lesen der SIP-Liste ist ein Fehler aufgetreten. ");
        return "";
    }

    return (new File(tempFolderName).getAbsolutePath());
}

From source file:com.daphne.es.maintain.editor.web.controller.OnlineEditorController.java

@RequestMapping("copy")
public String copy(@RequestParam(value = "descPath") String descPath,
        @RequestParam(value = "paths") String[] paths, @RequestParam(value = "conflict") String conflict,
        RedirectAttributes redirectAttributes) throws IOException {

    String rootPath = sc.getRealPath(ROOT_DIR);
    descPath = URLDecoder.decode(descPath, Constants.ENCODING);

    for (int i = 0, l = paths.length; i < l; i++) {
        String path = paths[i];/*from   ww  w.  j a  v a 2s .co m*/
        path = URLDecoder.decode(path, Constants.ENCODING);
        paths[i] = (rootPath + File.separator + path).replace("\\", "/");
    }

    try {
        File descPathFile = new File(rootPath + File.separator + descPath);
        for (String path : paths) {
            File sourceFile = new File(path);
            File descFile = new File(descPathFile, sourceFile.getName());
            if (descFile.exists() && "ignore".equals(conflict)) {
                continue;
            }

            FileUtils.deleteQuietly(descFile);

            if (sourceFile.isDirectory()) {
                FileUtils.copyDirectoryToDirectory(sourceFile, descPathFile);
            } else {
                FileUtils.copyFileToDirectory(sourceFile, descPathFile);
            }

        }
        redirectAttributes.addFlashAttribute(Constants.MESSAGE, "???");
    } catch (Exception e) {
        redirectAttributes.addFlashAttribute(Constants.ERROR, e.getMessage());
    }

    redirectAttributes.addAttribute("path", URLEncoder.encode(descPath, Constants.ENCODING));
    return redirectToUrl(viewName("list"));
}

From source file:de.uzk.hki.da.cli.Cli.java

/**
 * Copies the files listed in a file list to a single directory
 * // w w  w .j a v a  2 s . c o m
 * @param fileListFile The file list file
 * @return The path to the directory containing the files
 */
private String copySipContentToFolder(File fileListFile) {

    CliProgressManager progressManager = new CliProgressManager();

    String tempFolderName = getTempFolderName();

    String fileList = "";
    try {
        fileList = StringUtilities.readFile(fileListFile);
    } catch (Exception e) {
        logger.error("Failed to read file " + fileListFile.getAbsolutePath(), e);
        System.out.println("Die Datei " + fileListFile.getAbsolutePath() + " konnte nicht gelesen werden.");
        return "";
    }

    fileList = fileList.replace("\r", "");
    if (!fileList.endsWith("\n"))
        fileList += "\n";

    long files = 0;
    for (int i = 0; i < fileList.length(); i++) {
        if (fileList.charAt(i) == '\n')
            files++;
    }
    progressManager.setTotalSize(files);

    File tempDirectory = new File(tempFolderName + File.separator + sipFactory.getName());
    tempDirectory.mkdirs();

    while (true) {
        int index = fileList.indexOf('\n');

        if (index >= 0) {
            String filepath = fileList.substring(0, index);
            fileList = fileList.substring(index + 1);

            File file = new File(filepath);
            if (!file.exists()) {
                logger.error("File " + file.getAbsolutePath() + " is referenced in filelist, "
                        + "but does not exist");
                System.out.println("\nDie in der Dateiliste angegebene Datei " + file.getAbsolutePath()
                        + " existiert nicht.");
                FolderUtils.deleteQuietlySafe(tempDirectory);
                return "";
            }

            try {
                if (file.isDirectory())
                    FileUtils.copyDirectoryToDirectory(file, tempDirectory);
                else
                    FileUtils.copyFileToDirectory(file, tempDirectory);
                progressManager.copyFilesFromListProgress();
            } catch (IOException e) {
                logger.error("Failed to copy file " + file.getAbsolutePath() + " to folder "
                        + tempDirectory.getAbsolutePath(), e);
                System.out.println("\nDie in der Dateiliste angegebene Datei " + file.getAbsolutePath()
                        + " konnte nicht kopiert werden.");
                FolderUtils.deleteQuietlySafe(tempDirectory);
                return "";
            }
        } else
            break;
    }

    return (tempDirectory.getAbsolutePath());
}

From source file:edu.isi.wings.portal.controllers.RunController.java

private void uploadDirectory(ServerDetails server, File tempdir) {
    if (server.getHost() != null) {
        Machine m = new Machine(server.getHost());
        m.setHostName(server.getHost());
        m.setUserId(server.getHostUserId());
        m.setUserKey(server.getPrivateKey());
        HashMap<String, String> filemap = new HashMap<String, String>();
        String srvdir = server.getDirectory();
        for (File f : FileUtils.listFiles(tempdir, null, true)) {
            String fpath = f.getAbsolutePath();
            String srvpath = fpath.replace(tempdir.getParent(), srvdir);
            filemap.put(fpath, srvpath);
        }//from   ww  w . ja  v  a 2  s  .co m
        GridkitCloud.uploadFiles(m, filemap);
    } else {
        try {
            FileUtils.copyDirectoryToDirectory(tempdir, new File(server.getDirectory()));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

From source file:de.uzk.hki.da.cli.Cli.java

/**
 * Copies the files listed in a SIP list to a single directory
 * // ww  w .  j  a v a 2 s .c  o m
 * @param fileListFile The SIP list file
 * @return The path to the directory containing the files
 */
private String copySipListContentToFolder(File sipListFile) {

    CliProgressManager progressManager = new CliProgressManager();

    String tempFolderName = getTempFolderName();

    XMLReader xmlReader = null;
    SAXParserFactory spf = SAXParserFactory.newInstance();
    try {
        xmlReader = spf.newSAXParser().getXMLReader();
    } catch (Exception e) {
        logger.error("Failed to create SAX parser", e);
        System.out.println("Fehler beim Einlesen der SIP-Liste: SAX-Parser konnte nicht erstellt werden.");
        return "";
    }
    xmlReader.setErrorHandler(new ErrorHandler() {

        @Override
        public void error(SAXParseException e) throws SAXException {
            throw new SAXException("Beim Einlesen der SIP-Liste ist ein Fehler aufgetreten.", e);
        }

        @Override
        public void fatalError(SAXParseException e) throws SAXException {
            throw new SAXException("Beim Einlesen der SIP-Liste ist ein schwerer Fehler aufgetreten.", e);
        }

        @Override
        public void warning(SAXParseException e) throws SAXException {
            logger.warn("Warning while parsing siplist", e);
            System.out.println("\nWarnung:\n" + e.getMessage());
        }
    });

    InputStream inputStream;
    try {
        inputStream = new FileInputStream(sipListFile);

        Reader reader = new InputStreamReader(inputStream, "UTF-8");
        Builder parser = new Builder(xmlReader);
        Document doc = parser.build(reader);
        reader.close();

        Element root = doc.getRootElement();
        Elements sipElements = root.getChildElements("sip");

        long files = 0;
        for (int i = 0; i < sipElements.size(); i++) {
            Elements fileElements = sipElements.get(i).getChildElements("file");
            if (fileElements != null)
                files += fileElements.size();
        }
        progressManager.setTotalSize(files);

        for (int i = 0; i < sipElements.size(); i++) {
            Element sipElement = sipElements.get(i);
            String sipName = sipElement.getAttributeValue("name");

            File tempDirectory = new File(tempFolderName + File.separator + sipName);
            if (tempDirectory.exists()) {
                FolderUtils.deleteQuietlySafe(new File(tempFolderName));
                System.out.println("\nDie SIP-Liste enthlt mehrere SIPs mit dem Namen " + sipName + ". "
                        + "Bitte vergeben Sie fr jedes SIP einen eigenen Namen.");
                return "";
            }
            tempDirectory.mkdirs();

            Elements fileElements = sipElement.getChildElements("file");

            for (int j = 0; j < fileElements.size(); j++) {
                Element fileElement = fileElements.get(j);
                String filepath = fileElement.getValue();

                File file = new File(filepath);
                if (!file.exists()) {
                    logger.error("File " + file.getAbsolutePath() + " is referenced in siplist, "
                            + "but does not exist");
                    System.out.println("\nDie in der SIP-Liste angegebene Datei " + file.getAbsolutePath()
                            + " existiert nicht.");
                    FolderUtils.deleteQuietlySafe(new File(tempFolderName));
                    return "";
                }

                try {
                    if (file.isDirectory())
                        FileUtils.copyDirectoryToDirectory(file, tempDirectory);
                    else
                        FileUtils.copyFileToDirectory(file, tempDirectory);
                    progressManager.copyFilesFromListProgress();
                } catch (IOException e) {
                    logger.error("Failed to copy file " + file.getAbsolutePath() + " to folder "
                            + tempDirectory.getAbsolutePath(), e);
                    System.out.println("\nDie in der SIP-Liste angegebene Datei " + file.getAbsolutePath()
                            + " konnte nicht kopiert werden.");
                    FolderUtils.deleteQuietlySafe(new File(tempFolderName));
                    return "";
                }
            }
        }
    } catch (Exception e) {
        logger.error("Failed to read siplist " + sipListFile.getAbsolutePath(), e);
        System.out.println("\nBeim Lesen der SIP-Liste ist ein Fehler aufgetreten. ");
        return "";
    }

    return (new File(tempFolderName).getAbsolutePath());
}

From source file:com.bibisco.manager.ProjectManager.java

public static ProjectDTO importProject(ImportProjectArchiveDTO pImportProjectArchiveDTO) {

    ProjectDTO lProjectDTO = null;//w  w  w . j ava2  s.co m

    mLog.debug("Start exportProject(String)");
    try {

        ContextManager lContextManager = ContextManager.getInstance();

        // get temp directory
        String lStrTempDirectory = lContextManager.getTempDirectoryPath();

        // if there is already a directory for the project, delete it   
        if (pImportProjectArchiveDTO.isAlreadyPresent()) {
            FileUtils.deleteDirectory(new File(getDBProjectDirectory(pImportProjectArchiveDTO.getIdProject())));
        }

        // copy files to db project directory
        FileUtils.copyDirectoryToDirectory(
                new File(lStrTempDirectory + pImportProjectArchiveDTO.getIdProject()),
                new File(lContextManager.getDbDirectoryPath()));

        // set project name to context
        ContextManager.getInstance().setIdProject(pImportProjectArchiveDTO.getIdProject());

        // check if project is created with previuos version of bibisco and update it
        checkProjectVersionAndUpdateIfNecessary(pImportProjectArchiveDTO.getIdProject());

        // load project
        lProjectDTO = load();

        // set language to context
        ContextManager.getInstance().setProjectLanguage(lProjectDTO.getLanguage());

        // if not exists, insert project into bibisco db
        if (!pImportProjectArchiveDTO.isAlreadyPresent()) {
            insertIntoBibiscoDB(lProjectDTO);
        }

        // delete temp directory content
        FileUtils.cleanDirectory(new File(lStrTempDirectory));

    } catch (Throwable t) {
        mLog.error(t);
        throw new BibiscoException(t, BibiscoException.IO_EXCEPTION);
    }

    mLog.debug("End exportProject(String)");

    return lProjectDTO;
}

From source file:display.containers.FileManager.java

/**
 * Deplace les fichiers / repertoire selectionnees vers le dossier dir
 * @param currentDir2/*from w w  w.j a  v a  2s . c  o m*/
 * @throws IOException 
 */
public void copySelectedFilesTo(File dir) throws IOException {
    // Recupere les lignes selectionnees
    int[] indices = table.getSelectedRows();
    // On recupere les fichiers correspondants
    ArrayList<File> files = new ArrayList<File>();
    for (int i = 0; i < indices.length; i++) {
        int row = table.convertRowIndexToModel(indices[i]);
        File fi = ((FileTableModel) table.getModel()).getFile(row);
        if (!continueAction) {
            continueAction = true;
            return;
        }
        if (!fi.getName().contains("..")) {
            if (fi.isDirectory())
                FileUtils.copyDirectoryToDirectory(fi, dir);
            else
                FileUtils.copyFileToDirectory(fi, dir);
        }
    }
}

From source file:de.blizzy.documentr.page.PageStore.java

@Override
public void relocatePage(final String projectName, final String branchName, final String path,
        String newParentPagePath, User user) throws IOException {

    Assert.hasLength(projectName);/*w  ww.j a va  2 s  .  c om*/
    Assert.hasLength(branchName);
    Assert.hasLength(path);
    Assert.hasLength(newParentPagePath);
    Assert.notNull(user);
    // check if pages exist by trying to load them
    getPage(projectName, branchName, path, false);
    getPage(projectName, branchName, newParentPagePath, false);

    ILockedRepository repo = null;
    List<String> oldPagePaths;
    List<String> deletedPagePaths;
    List<String> newPagePaths;
    List<PagePathChangedEvent> pagePathChangedEvents;
    try {
        repo = globalRepositoryManager.getProjectBranchRepository(projectName, branchName);
        String pageName = path.contains("/") ? StringUtils.substringAfterLast(path, "/") : path; //$NON-NLS-1$ //$NON-NLS-2$
        final String newPagePath = newParentPagePath + "/" + pageName; //$NON-NLS-1$

        File workingDir = RepositoryUtil.getWorkingDir(repo.r());

        File oldSubPagesDir = Util.toFile(new File(workingDir, DocumentrConstants.PAGES_DIR_NAME), path);
        oldPagePaths = listPagePaths(oldSubPagesDir, true);
        oldPagePaths = Lists.newArrayList(Lists.transform(oldPagePaths, new Function<String, String>() {
            @Override
            public String apply(String p) {
                return path + "/" + p; //$NON-NLS-1$
            }
        }));
        oldPagePaths.add(path);

        File deletedPagesSubDir = Util.toFile(new File(workingDir, DocumentrConstants.PAGES_DIR_NAME),
                newPagePath);
        deletedPagePaths = listPagePaths(deletedPagesSubDir, true);
        deletedPagePaths = Lists.newArrayList(Lists.transform(deletedPagePaths, new Function<String, String>() {
            @Override
            public String apply(String p) {
                return newPagePath + "/" + p; //$NON-NLS-1$
            }
        }));
        deletedPagePaths.add(newPagePath);

        Git git = Git.wrap(repo.r());
        AddCommand addCommand = git.add();

        for (String dirName : Sets.newHashSet(DocumentrConstants.PAGES_DIR_NAME,
                DocumentrConstants.ATTACHMENTS_DIR_NAME)) {
            File dir = new File(workingDir, dirName);

            File newSubPagesDir = Util.toFile(dir, newPagePath);
            if (newSubPagesDir.exists()) {
                git.rm().addFilepattern(dirName + "/" + newPagePath).call(); //$NON-NLS-1$
            }
            File newPageFile = Util.toFile(dir, newPagePath + DocumentrConstants.PAGE_SUFFIX);
            if (newPageFile.exists()) {
                git.rm().addFilepattern(dirName + "/" + newPagePath + DocumentrConstants.PAGE_SUFFIX).call(); //$NON-NLS-1$
            }
            File newMetaFile = Util.toFile(dir, newPagePath + DocumentrConstants.META_SUFFIX);
            if (newMetaFile.exists()) {
                git.rm().addFilepattern(dirName + "/" + newPagePath + DocumentrConstants.META_SUFFIX).call(); //$NON-NLS-1$
            }

            File newParentPageDir = Util.toFile(dir, newParentPagePath);
            File subPagesDir = Util.toFile(dir, path);
            if (subPagesDir.exists()) {
                FileUtils.copyDirectoryToDirectory(subPagesDir, newParentPageDir);
                git.rm().addFilepattern(dirName + "/" + path).call(); //$NON-NLS-1$
                addCommand.addFilepattern(dirName + "/" + newParentPagePath + "/" + pageName); //$NON-NLS-1$ //$NON-NLS-2$
            }
            File pageFile = Util.toFile(dir, path + DocumentrConstants.PAGE_SUFFIX);
            if (pageFile.exists()) {
                FileUtils.copyFileToDirectory(pageFile, newParentPageDir);
                git.rm().addFilepattern(dirName + "/" + path + DocumentrConstants.PAGE_SUFFIX).call(); //$NON-NLS-1$
                addCommand.addFilepattern(
                        dirName + "/" + newParentPagePath + "/" + pageName + DocumentrConstants.PAGE_SUFFIX); //$NON-NLS-1$ //$NON-NLS-2$
            }
            File metaFile = Util.toFile(dir, path + DocumentrConstants.META_SUFFIX);
            if (metaFile.exists()) {
                FileUtils.copyFileToDirectory(metaFile, newParentPageDir);
                git.rm().addFilepattern(dirName + "/" + path + DocumentrConstants.META_SUFFIX).call(); //$NON-NLS-1$
                addCommand.addFilepattern(
                        dirName + "/" + newParentPagePath + "/" + pageName + DocumentrConstants.META_SUFFIX); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }

        addCommand.call();
        PersonIdent ident = new PersonIdent(user.getLoginName(), user.getEmail());
        git.commit().setAuthor(ident).setCommitter(ident)
                .setMessage("move " + path + " to " + newParentPagePath + "/" + pageName) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                .call();
        git.push().call();

        newPagePaths = Lists.transform(oldPagePaths, new Function<String, String>() {
            @Override
            public String apply(String p) {
                return newPagePath + StringUtils.removeStart(p, path);
            }
        });

        pagePathChangedEvents = Lists.transform(oldPagePaths, new Function<String, PagePathChangedEvent>() {
            @Override
            public PagePathChangedEvent apply(String oldPath) {
                String newPath = newPagePath + StringUtils.removeStart(oldPath, path);
                return new PagePathChangedEvent(projectName, branchName, oldPath, newPath);
            }
        });

        PageUtil.updateProjectEditTime(projectName);
    } catch (GitAPIException e) {
        throw new IOException(e);
    } finally {
        Closeables.closeQuietly(repo);
    }

    Set<String> allDeletedPagePaths = Sets.newHashSet(oldPagePaths);
    allDeletedPagePaths.addAll(deletedPagePaths);
    eventBus.post(new PagesDeletedEvent(projectName, branchName, allDeletedPagePaths));

    for (String newPath : newPagePaths) {
        eventBus.post(new PageChangedEvent(projectName, branchName, newPath));
    }

    for (PagePathChangedEvent event : pagePathChangedEvents) {
        eventBus.post(event);
    }
}

From source file:io.snappydata.hydra.cluster.SnappyTest.java

public static synchronized void HydraTask_copyDiskFiles() {
    if (diskDirExists)
        return;/*from w  w  w . ja va  2  s  .  c  o  m*/
    else {
        String dirName = snappyTest.generateLogDirName();
        File destDir = new File(dirName);
        String diskDirName = dirName.substring(0, dirName.lastIndexOf("_")) + "_disk";
        File dir = new File(diskDirName);
        for (File srcFile : dir.listFiles()) {
            try {
                if (srcFile.isDirectory()) {
                    FileUtils.copyDirectoryToDirectory(srcFile, destDir);
                    Log.getLogWriter()
                            .info("Done copying diskDirFile directory from: " + srcFile + " to " + destDir);
                } else {
                    FileUtils.copyFileToDirectory(srcFile, destDir);
                    Log.getLogWriter().info("Done copying diskDirFile from: " + srcFile + " to " + destDir);
                }
            } catch (IOException e) {
                throw new TestException(
                        "Error occurred while copying data from file: " + srcFile + "\n " + e.getMessage());
            }
        }
        diskDirExists = true;
    }
}

From source file:io.snappydata.hydra.cluster.SnappyTest.java

public static synchronized void HydraTask_copyDiskFiles_gemToSnappyCluster() {
    Set<File> myDirList = getDirList("dirName_");
    if (diskDirExists)
        return;//from w w  w.jav a2s.  c  o m
    else {
        String dirName = snappyTest.generateLogDirName();
        File destDir = new File(dirName);
        String[] splitedName = RemoteTestModule.getMyClientName().split("snappy");
        String newName = splitedName[1];
        File currentDir = new File(".");
        for (File srcFile1 : currentDir.listFiles()) {
            if (!doneCopying) {
                if (srcFile1.getAbsolutePath().contains(newName)
                        && srcFile1.getAbsolutePath().contains("_disk")) {
                    if (myDirList.contains(srcFile1)) {
                        Log.getLogWriter().info("List contains entry for the file... " + myDirList.toString());
                    } else {
                        SnappyBB.getBB().getSharedMap().put(
                                "dirName_" + RemoteTestModule.getMyPid() + "_" + snappyTest.getMyTid(),
                                srcFile1);
                        File dir = new File(srcFile1.getAbsolutePath());
                        Log.getLogWriter().info("Match found for file: " + srcFile1.getAbsolutePath());
                        for (File srcFile : dir.listFiles()) {
                            try {
                                if (srcFile.isDirectory()) {
                                    FileUtils.copyDirectoryToDirectory(srcFile, destDir);
                                    Log.getLogWriter().info("Done copying diskDirFile directory from ::"
                                            + srcFile + "to " + destDir);
                                } else {
                                    FileUtils.copyFileToDirectory(srcFile, destDir);
                                    Log.getLogWriter().info(
                                            "Done copying diskDirFile from ::" + srcFile + "to " + destDir);
                                }
                                doneCopying = true;
                            } catch (IOException e) {
                                throw new TestException("Error occurred while copying data from file: "
                                        + srcFile + "\n " + e.getMessage());
                            }
                        }
                    }
                }
            }
        }
        diskDirExists = true;
    }
}