regExp

Post Reply
caio
Newbie
Posts: 13
Joined: Tue Mar 22, 2011 8:27 am

regExp

Post by caio »

I

I have to copy files from directory but i know only first segment of file's name



Can I use the RegExp on "createPathWithName"?



Somethings like this:





var ThePath = job.createPathWithName("FirstSegmentOfTheName" + /.{n,}/);



s.copy( "/My_Disk/folder/FirstSegmentOfTheName" + /.{n,}/, TheSourcePath);



Tank you for any suggestions....





caio guardigli

Centro Stampa Digitalprint srl

Rimini - Italy
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

regExp

Post by dkelly »

You can't use regular expressions since those functions take String args.



You can do something like this:





var theDirName = "/My_Disk/folder";

var myDir = new Dir(theDirName);

var theFiles = myDir.entryList("FirstSegmentOfTheName*", Dir.Files, Dir.Name);

var i;

for (i=0; i < theFiles.length; i++) {

var theDestPath = job.createPathWithName(theFiles);

s.copy( theDirName + "/" + theFiles, theDestPath );

}





Dwight Kelly

Apago, Inc.

dkelly@apago.com
caio
Newbie
Posts: 13
Joined: Tue Mar 22, 2011 8:27 am

regExp

Post by caio »

tank you!



In the "Dir Class" there is the solution....


Post Reply