getFiles(mask) how to??

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
mads
Posts: 33
Joined: October 15th, 2004, 6:38 am
Location: Denmark
Contact:

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
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

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
Last edited by Paul Tuersley on March 13th, 2005, 2:53 am, edited 2 times in total.
mads
Posts: 33
Joined: October 15th, 2004, 6:38 am
Location: Denmark
Contact:

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
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

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?
Post Reply