package it.backbox.transaction;

import it.backbox.utility.Utility;

import java.io.File;

public class CopyTask extends Task {

	private String srcPath;
	private String destPath;
	
	public void setInput(String srcPath, String destPath) {
		this.srcPath = srcPath;
		this.destPath = destPath;
	}
	
	public CopyTask() {
		super();
	}
	
	public CopyTask(String srcPath, String destPath) {
		super();
		setInput(srcPath, destPath);
	}

	@Override
	public void run() throws Exception {
		File dest = new File(destPath);
		File parent = dest.getParentFile();
		if((parent != null) && !parent.exists() && !parent.mkdirs()){
		    throw new IllegalStateException("Couldn't create dir: " + parent);
		}
		dest.createNewFile();
		Utility.copy(new File(srcPath), dest);
	}

}

@@ -584,17 +584,17 @@
 %09%09if
-(
+ 
 (parent 
 != n
@@ -593,58 +593,16 @@
 ent 
-!
+=
 = null)
- && !parent.exists() && !parent.mkdirs())%7B
 %0D%0A%09%09
@@ -667,21 +667,60 @@
 %22 + 
-parent);%0D%0A%09%09%7D
+dest);%0D%0A%09%09if (!parent.exists())%0D%0A%09%09%09parent.mkdirs();
 %0D%0A%09%09

make file hierarchy copying files