getFileList not handling variable for flag


I am working on the file managment part of my script but I am having trouble with the -filespec flag not accepting a string variable, if I explicitly use an extension e.g. “*.jpg”, it works like it should, but I am trying to use the file the user 1st selects through fileDialog to both snag the path and its extension. The extension will then be used to filter out the junk files (thumbs.db, OSX leftover files, etc). I can only think that perhaps the wildcard may need some kind of formating like quote marks do.

string $firstImage = fileDialog; // User selects 1st image in sequence
string $imageDir = (dirname ($firstImage) + “/”); // Slash must be added
string $fileType = ( “”" + “." + fileExtension($firstImage) + “”"); // Format the file type to ".ext” format
// string $fileList[] = getFileList -folder $imageDir -filespec "*.jpg"; //This works
string $fileList[] = getFileList -folder $imageDir -filespec $fileType; //This doesn’t

       for( $file in $fileList ) 
           print ("-" + $file + "

print (”
" + "File Type = " + $fileType + "
print ("Directory = " + $imageDir + "
print ("Total Files = " + size $fileList + "


Hi. You dont need to put the quotes around the file type variable… mel knows that it’s a string by the way it’s been defined…

  string $fileType = ("*." + ` fileExtension($firstImage)`);

You only need it when you manually specify a string… as you have demonstrated with both working and not working lines you have tried.




Thanks Andrew! Works like charm.



This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.