Recursively Print Data Folder Paths

//  PrintDataFolderPaths(startingDFR, level)
//  Recursively prints data folder paths
//  Example: PrintDataFolderPaths(root:, 0)
//  Requires Igor Pro 6.1 or later
Function PrintDataFolderPaths(startingDFR, level)
    DFREF startingDFR
    Variable level          // 0 for top level

    Variable i
   
    String prefix = ""              // Used to show data folder level using indentation
    for(i=0; i<level; i += 1)
        prefix += "\t"
    endfor
   
    Variable numDataFolders = CountObjectsDFR(startingDFR, 4)
    for(i=0; i<numDataFolders; i+=1)
        String dfName = GetIndexedObjNameDFR(startingDFR, 4, i)
        if (strlen(dfName) == 0)
            break
        endif
       
        DFREF dfr = startingDFR:$dfName
        String path = GetDataFolder(1, dfr)
       
        Print prefix + path
       
        PrintDataFolderPaths(dfr, level+1)              // Returns
    endfor
End

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More