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

  • Filelist-- not detecting the correct file type


    While using -filelist- to find all pat("*.dta") files in my chosen directory, I have discovered the problem that the -filelist- falsely detects a ".do" file instead of the ".dta" file that follows it if they have the identical file name.

    For example, while running -filelist- on a directory that contains the following two files:

    the command -filelist, dir("$directory") pat("*.dta")- will detect and download, but not food.dta. I suspect that this is because of the order of the files.

    I have several thousand files that are formatted in that order in company-wide cloud storage, so changing file names or switching the order of files that fit this category is not an option.

    Does anyone know a fix for this problem?

    Thank you for your help,
    Last edited by Malcolm Ringger; 13 Jun 2018, 10:55.

  • #2
    I cannot replicate the problem.

    . dir e:/auto/
      <dir>   6/13/18 20:58  .                 
      <dir>   6/13/18 20:58  ..                
       0.0k   6/13/18 20:58           
       0.7k   6/13/18 20:58  auto.dta          
    . filelist , dir("e:/auto") pattern("*.dta") norecursive
    Number of files found = 1
    . list
         | dirname   filename   fsize |
      1. | e:/auto   auto.dta     743 |
    . which filelist
    *! version 2.0.7  08jun2015 Robert Picard,
    end of do-file
    I am using Stata 12.1 at the moment and I have downloaded filelist from SSC.



    • #3
      Thanks for checking in. I'm on Stata 14.2, but I don't think that should matter. I thought it might be a problem with string length because the file extensions are a few folders deep, but the latest version of -filelist- should solve that problem. Similarly, I think the newest version of -filelist- eliminates the maximum amount of files that can fit in the list, so that shouldn't be a problem in this case (currently accounting for 5360 files, need about 1000 more).

      Thanks again, I'll have to give the process another whack.


      • #4
        After restarting my computer for updates, it appear the problem has solved itself. I'm guessing it was solved by clearing my cache memory.