• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X PCB Editor
  3. Search files inside sub directories

Stats

  • Replies 3
  • Subscribers 158
  • Views 14180
  • Members are here 0
More Content

Search files inside sub directories

pcbnagaraj
pcbnagaraj over 13 years ago
Dear All,

Is there a way to search all *.dra files in the sub directories?

The below will list the dra in the root path but I need to get all dra files in the sub directories as well.

dra_list =  setof(file, getDirFiles(dra_path), cadddr(axlDMFileParts(file)) == "dra")

any suggestion is appreciated

Thanks,

Nagaraj.
  • Sign in to reply
  • Cancel
  • pcbnagaraj
    pcbnagaraj over 13 years ago
    Any suggestion??

    Thanks,

    Nagaraj.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Randy R
    Randy R over 13 years ago

    You could have the Operating System create a list of filenames in a file then read that file.

    For a Windows system:  system("dir *.brd /b/s >dir_list.txt")

    Hope this helps.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • eDave
    eDave over 13 years ago
    defun( DE_GetSubDirFiles (dir, fileNameOrTypeOnly @optional keepFileListing, "ttg")
     let((fileName, fileType, listingFile, p, ln, filePath, files)
    rexCompile("/")
    dir = rexReplace(dir, "\\\\", 0)
    fileName = if(index(fileNameOrTypeOnly, ".") then fileNameOrTypeOnly else strcat("*.", fileNameOrTypeOnly))
    fileType = lastelem(parseString(fileName, "."))
    sprintf(listingFile, "%s\\%s_files.listing", getShellEnvVar("TEMP"), fileType)
    when(zerop(system(sprintf(nil, "dir %s\\%s /s/b/-d > %s", dir, fileName, listingFile)))
    p = infile(listingFile)
    while(gets(ln, p)
    filePath = substring(ln, 1, strlen(ln) - 1)
    when(lastelem(parseString(filePath, ".")) == fileType, files = cons(axlOSSlash(filePath), files))
    )
    close(p)
    )
    and(!keepFileListing, isFile(listingFile), deleteFile(listingFile))
    files
    ))
    ; draFiles = DE_GetSubDirFiles("L:/library/build/development/allegro/symbols/package", "dra")
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information