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
regExp
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
regExp
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
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