Copy file to folder-script?

Post Reply
wolle
Newbie
Posts: 11
Joined: Thu Dec 09, 2010 9:37 am

Copy file to folder-script?

Post 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!
User avatar
foxpalace
Member
Posts: 33
Joined: Fri Jan 14, 2011 12:25 pm
Location: Germany

Copy file to folder-script?

Post 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());

}





Post Reply