Page 1 of 1

Copy file to folder-script?

Posted: Tue Nov 29, 2011 10:12 am
by wolle
Does anyone have a script - or know how to write it - that takes an incoming job, if it's a file, and copies it to a defined folder (arg1 as choose folder) and then lets the original file pass through.



Actually I need to copy to a networkfolder, and it can't be the normal Switch-method of moving files because that interferes with the hotfolder I'm moving to.



Anyone?



Thanks!

Copy file to folder-script?

Posted: Mon Dec 05, 2011 8:33 pm
by foxpalace
here is a example - you had to modify it, but it should show the way







function jobArrived( s : Switch, job : Job )

{

var pfad = job.getPath()+"/Bilder/";

var myDirectory = new Dir(pfad);

var source = myDirectory.entryList("*.jpg", Dir.Files, Dir.Name);



for (var i = 0; i < source.length; i++)

{

var source1 = new String(source);

var neuName = source1.substring(0,4);

s.copy(pfad+source,pfad+neuName+"-bla.jpg");

}

job.sendToSingle(job.getPath());

}