listdirectory3dsmaxmaxscript

Problem listing assets inside a directory list


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

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)
    
)

Solution

  • 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
        
    )