Thanks to Kit Baum, the package -fs- on SSC has been updated.
Stata 8 is required. Please use -ssc- if you wish to install
or replace this package.
The help for -extended_fcn- reveals an extended macro function
{local | global} macname :
dir ["]dirname["] {files|dirs|other} ["]pattern["] [, nofail ]
which may be used to get lists of file names satisfying a
specified pattern in a particular directory or folder.
-fs-, previously available in this package since 2004, is
a convenience wrapper based on using that function for _files_.
It was consciously designed as an analogue of the official
command -ds- which displays a compact list of names of variables
(satisfying some criterion) -- and also leaves that list in
a r-class result.
I have fixed a moderately esoteric bug in -fs- (meaning, it
apparently didn't surface and/or bite anyone until I wrote a more
demanding test suite).
I have also added a new command -folders- which is a wrapper using that
function for directories. (I rejected the name -dirs- as too
close to -dir-. I have broken a Stata rule in using an English
word for a command, so be warned that StataCorp in principle
may grab it back.)
Kit Baum's role here extends beyond putting this on SSC. He
contributed importantly to the design and testing of -folders- particularly
through a discussion of what a user would usually want or expect.
With no arguments, -folders- lists names of folders within the current folder.
Given a specification that is a pattern containing ? or *, -folders- lists
names of folders matching that pattern. The pattern may include a prefix
indicating a folder that is not the current folder.
Otherwise, given a specification that is a folder name, -folders- lists names
of folders contained within that folder.
So -folders- does slightly different things given different input, but
those things seem to reflect the questions users (or at least Kit and myself)
usually have.
Nick
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/