Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: capturing directories and file names that start with numebrs, ex: "1111.zip" (problem with dir extended_macro_function)
From
daniel klein <[email protected]>
To
[email protected]
Subject
Re: st: capturing directories and file names that start with numebrs, ex: "1111.zip" (problem with dir extended_macro_function)
Date
Tue, 29 Jan 2013 21:02:54 +0100
Lucas,
you need to be more specific on what exactly you mean, claiming that
"it does not work", and what exactly "that" is, you want to
"circumvent" here, as suggested in the FAQs
(http://www.stata.com/support/faqs/resources/statalist-faq/#advice).
This works perfect for me
cd c:/ado
sysuse auto ,clear
sa 42.dta
di `": dir . file "*.dta""'
erase 42.dta
Best
Daniel
--
Dear statalisters,
I need to import tousands of files that are in a folder. I know I
should to first extract a list with the file names.
The normal way to do that would be:
cd "directory name"
local allfiles : dir . files "*"
This works with alfabetic file-names. The problem is that file names
are numeric. For example:
"10001.zip"
"10002.zip"
"10003.zip"
the extended macro function "dir" does not seem to cope with numeric filenames.
( I also tryed with .dta files (like 111.dta, 222.dta) and it does not work.
Is there a way to circunvet this and get the correct list of file names?
regards
Lucas Mation
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/