Page 1 of 1
getFiles(mask) how to??
Posted: February 26th, 2005, 1:42 pm
by mads
I want too only import *.TGA And *.PSD
if I write
myFolder.getFiles('*psd*);
I get the PSD but how do I write a mask that include .tga??
-mads
Posted: February 26th, 2005, 5:12 pm
by Paul Tuersley
According to the scripting guide you can use a function instead of a mask. Here's an example:
Code: Select all
{
function testFiles(theFile) {
if (theFile.name.indexOf(".psd") != -1 || theFile.name.indexOf(".tga") != -1) {
return true;
}
}
var theFolder = folderGetDialog("Import Items from Folder...");
var filesArray = theFolder.getFiles(testFiles);
alert("There are " + filesArray.length + " valid files");
}
Paul T
Posted: February 27th, 2005, 6:56 am
by mads
Thank you this works
But I was wondering if it was possible to make a mask that included more than one file extension,something like:
myFolder.getFiles('*.tga'+'*.psd');
but I guess this isn´t possible?
-mads
Posted: June 1st, 2005, 12:01 pm
by byronnash
Sort of on this topic, how can you find the subfolders of a folder you picked with folderGetDialog()? mads, did you ever find out how to mask multiple file types? What if your extensions are all caps?