diff --git a/Toolbox Migration/src/com/bayer/edam/excelimport/CropAssetCopyTool.java b/Toolbox Migration/src/com/bayer/edam/excelimport/CropAssetCopyTool.java index 94eb563..2a57d92 100644 --- a/Toolbox Migration/src/com/bayer/edam/excelimport/CropAssetCopyTool.java +++ b/Toolbox Migration/src/com/bayer/edam/excelimport/CropAssetCopyTool.java @@ -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 {