I’m playing around with copying file and zipping them. Its all pretty sequential i.e. copy file now zip it. I just tried to copy a 2 gig file and zip it - it failed and I suspect the reason is the copy process didn’t complete before the code executed to zip the file.
Is there a more graceful way to do this…? I’m think some kind of a “pause” to allow time for the copy to complete. Better yet would be if the zip function zipped TO a folder. (I’m working with IT2Be tools to perform the zip)
any thoughts?
function getFile(event) {
var f = plugins.file.showFileOpenDialog(1,null,false,new Array("TXT and CSV","txt","csv"));
f = plugins.file.convertToJSFile(f)
gfileFull = f
gfileName = f.getName();
var fcopy = plugins.file.createFile("c:/temp/" + gfileName);
application.output('ffcopy:' + fcopy);
if(!plugins.file.copyFile(f, fcopy)){
application.output("failed");
}else{
application.output(plugins.it2be_tools.zip(f.getAbsolutePath(),true));
application.output("success");
}
}