Example usage for org.apache.commons.vfs FileObject copyFrom

List of usage examples for org.apache.commons.vfs FileObject copyFrom

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileObject copyFrom.

Prototype

public void copyFrom(FileObject srcFile, FileSelector selector) throws FileSystemException;

Source Link

Document

Copies another file, and all its descendents, to this file.

Usage

From source file:pt.webdetails.cpf.repository.vfs.VfsRepositoryAccess.java

public SaveFileStatus copySolutionFile(String fromFilePath, String toFilePath) throws IOException {
    try {//from w ww .j  a  v a  2s.  c  o  m
        FileObject to = resolveFile(repo, toFilePath);
        FileObject from = resolveFile(repo, fromFilePath);
        to.copyFrom(from, Selectors.SELECT_SELF);
        if (to != null && to.exists() && to.isReadable()) {
            return SaveFileStatus.OK;
        }
    } catch (Exception e) {
        log.error("Cannot copy from " + fromFilePath + " to " + toFilePath, e);
    }
    return SaveFileStatus.FAIL;
}