CropAssetCopyTool: skipLines
This commit is contained in:
@@ -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,15 +173,22 @@ 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)
|
||||
if (!dryRun) {
|
||||
try {
|
||||
FileUtils.copyFile(file, targetFile);
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
log.error("IOException: '" + ioe.getMessage() + "'");
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
log.error("'" + filePath + "' not found");
|
||||
|
||||
Reference in New Issue
Block a user