本文整理汇总了Java中jodd.io.FileUtil.copyDir方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.copyDir方法的具体用法?Java FileUtil.copyDir怎么用?Java FileUtil.copyDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jodd.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.copyDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import jodd.io.FileUtil; //导入方法依赖的package包/类
@Override
public void create(String name, Long createFrom) throws IOException {
RepoXml lRepoXml_new, lRepoXml_existed = null;
File lFileDirNewRepo, lFileDirExistedRepo;
// Reject if new repository name already exist.
Validate.isTrue(!repoXmlDao.existsByName(name), "Name of new repository already exist: " + name);
// Check if source RepoXml(aka createFrom) does not found in database.
if (createFrom != null) {
lRepoXml_existed = repoXmlDao.selectById(createFrom);
Validate.notNull(lRepoXml_existed, "The source xml repository were not found.");
}
// 1. Add record for new xml repository to table
lRepoXml_new = new RepoXml();
lRepoXml_new.setName(name);
lRepoXml_new.setDateCreation(new Date());
repoXmlDao.insert(lRepoXml_new);
// 2. Copy data from a table to another table.
if (lRepoXml_existed != null) {
// If source repository exists, do copy data.
lRepoXml_new = repoXmlDao.selectByName(lRepoXml_new.getName());
repoXmlFileDao.copyExistingRecordsForNewXmlRepo(createFrom, lRepoXml_new.getId());
}
// 3. Create a folder for new repository.
lFileDirNewRepo = ConfigurationUtil.getXmlRepositoryDir(lRepoXml_new.getName());
lFileDirNewRepo.mkdirs();
// 4. Copy folder content from existing repository to new repository.
if (lRepoXml_existed != null) {
// Assign variable "lFileDirNewRepo" is not needed cause it was already assigned.
lFileDirExistedRepo = ConfigurationUtil.getXmlRepositoryDir(lRepoXml_existed.getName());
FileUtil.copyDir(lFileDirExistedRepo, lFileDirNewRepo);
}
}
示例2: copyDir
import jodd.io.FileUtil; //导入方法依赖的package包/类
public
static void copyDir(String srcDir, String destDir) throws Exception {
FileUtil.copyDir(polishFilePath(srcDir), polishFilePath(destDir));
}