I have a Switch Java script that I modified from other scripts that accepts a folder, look for a certain string in a file, and does not copy that file over with the rest of the files in the folder (I basically just want to delete this file from the folder, but as the filename always differs slightly, I had to create a script for this).....this works perfectly, however, none of my subfolders and their contents gets copied either. I am not sure how to do this (copy all subfolders as well), any suggestions or tips will be awesome. I am using Powerswitch 08, on Windows 7.
So just to explain what happens, folder goes into the script, outputs all files except files that contains "CRC_", but does not output any subfolders with their files.
Here is my current script:
function jobArrived( s : Switch, job : Job )
var jobDir = new Dir(job.getPath());
var files = jobDir.entryList("*", Dir.Files, Dir.Name);
var tempFolder = job.createPathWithName(job.getName(), true);
for (var i = 0; i < files.length; i++)
var tempfile = "";
var file = new File(jobDir.path + "/" + files);
if (file.name.indexOf("CRC_") == -1)
s.copy(job.getPath() + "/" + file.name, tempFolder + "/" + file.name);
1 post • Page 1 of 1