CropAssetCopyTool: skipLines

This commit is contained in:
gexce
2017-08-17 16:58:14 +02:00
parent a7a98c0f51
commit 129e1bbe87
@@ -32,6 +32,7 @@ public class CropAssetCopyTool {
private static Logger log = Logger.getLogger(CropAssetCopyTool.class);
private static boolean dryRun = true;
private static int skipLines = 0;
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - SQL Server\\export-2017-08-15.csv";
@@ -70,6 +71,11 @@ public class CropAssetCopyTool {
for (String[] line : inputRows) {
lineNo++;
if (lineNo < skipLines) {
continue;
}
Integer assetId = Integer.parseInt(line[0]);
if (processedAssetIDs.contains(assetId)) {
@@ -167,14 +173,21 @@ public class CropAssetCopyTool {
targetFile = new File(targetDir + "\\" + newName);
}
log.info("(AssetID " + assetId + ") Target file '" + targetName + "' already exists. Copy file as '" + targetFile.getName() + "'");
log.info("AssetID " + assetId + ": Target file '" + targetName + "' already exists. Copy file as '" + targetFile.getName() + "'");
line[1] = targetFile.getName();
}
log.debug("Copy " + file.getAbsolutePath() + " (AssetID " + assetId + ") to " + targetFile.getAbsolutePath());
if (!dryRun)
FileUtils.copyFile(file, targetFile);
if (!dryRun) {
try {
FileUtils.copyFile(file, targetFile);
}
catch (IOException ioe) {
log.error("IOException: '" + ioe.getMessage() + "'");
ioe.printStackTrace();
}
}
}
}
else {