Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • -project- cleanup: too many filenames

    Dear Statalist.

    I am using the user written command -project- by Robert Picard, version 1.3.1, on Stata 13.1 (15 Jan 2014) on a Unix machine. The command is extremely useful. I've run into a small problem.

    When trying to perform a -cleanup- task, the cleanup stops after going through some files and returns a "too many filenames" error message. I do have a large number of files in my project.

    I suppose this may be due to limits on the length of Stata macros. Is there anyway around this? I suppose I could fiddle around with the project ado files and try to see how the cleanup filelist is stored, but I hope someone knows about an easier solution.

    Thank you.




    Jorge Eduardo Pérez Pérez
    www.jorgeperezperez.com

  • #2
    So I actually looked at the project ado file and the line that leads into the problem is (probably)

    Code:
    // get a list of all files in the current directory
    local flist: dir "`currentdir'" files "*"
    I will increase the macro length to the maximum, but just in case, any ideas on how to obtain a list of files and store it without hitting the macro length limits?



    Jorge Eduardo Pérez Pérez
    www.jorgeperezperez.com

    Comment


    • #3
      There's indeed a limit to how many file names you can fit into a single macro using Stata's dir extended function. See help limits and "# of characters in a macro". You must have a lot of files in that directory. With an average 20 characters per filename, that's still 50K files in a single directory if you are using Stata/SE or Stata/MP (much less if you are using Stata/Small or Stata/IC). There's a way to program around this using Mata and that may happen in a future version of project (and filelist, also from SSC) but of course that won't help you in this immediate case.

      If there's no other way to disentangle the set of files that should be in the project from those that should be removed, then you could use something like
      Code:
      project xyz, share(me,all)
      to create an archive of what's in the project. For the directory in question, you can then replace its content with the one in the archive you just created. The archive only contains files that are part of the project and is essentially an image of what you should be left with if project xyz, cleanup is run, notwithstanding the error you encountered.

      Comment


      • #4
        Increasing the macro length by increasing the maximum number of variables worked for me, turns out that Stata in the Unix server had a low -maxvar- setting, and therefore low macro length limits. Thank you for the suggestion though, I will need this in the near future.

        Jorge Eduardo Pérez Pérez
        www.jorgeperezperez.com

        Comment

        Working...
        X