Problem listing assets inside a directory list

33 Views Asked by At

I need to do list of assets that are inside a list of directories. So, the step-by-step is this:

  • The user selects a Parent Directory which contains all the other directories with assets and then makes a list with these directories;
  • Then, I have to access the first directory of the list and make another list with the assets inside the directory.

The problem is that when I run the code for the first time without the loop, it made the list of directories perfectly. But when I try to run with the loop the Scripting Listener says:

"Error occurred in anonymous codeblock; filename:
E:\MUVA\MaxScript\teste.ms; position: 371; line: 9
-- No "map" function for "\*""

And then I have to restart the 3ds Max and delete the loop for the first step works again. Maybe there's something wrong with my logical that I'm not seeing.

dirPath = getSavePath caption: "SELECT THE PARENT DIRECTORY"
dirList = getDirectories dirPath + "\*"
print ("Directories: " + dirList)

for dir in dirList do(
    
    assetsPath = dir + "\*.max"
    assetsList = getFiles assetsPath
    print ("List of assets: " + assetsList)
    
)
1

There are 1 best solutions below

0
Lucas Costanski On BEST ANSWER

And yes, my logical was wrong. I update the code and get ot the result I want.

directoryParent = getSavePath caption: "SELECT THE PARENT DIRECTORY"
dirPath = directoryParent + "\*"
dirList = getDirectories dirPath
print dirList

for dir in dirList do(
    
    assetsPath = dir + "\*.max"
    assetsList = getFiles assetsPath
    print assetsList
    
)