Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: saving all file names in directory/folder


From   "Gabi Huiber" <[email protected]>
To   [email protected]
Subject   Re: st: saving all file names in directory/folder
Date   Thu, 17 Apr 2008 14:19:09 -0400

I would reiterate here an earlier suggestion by Nick Cox:

When reading directory paths in Stata, always use forward slashes. So

dir "c:/data/kingdom/"

instead of

dir "C:\data\kingdom\"

Windows does not care. Unix would, but that's not the reason for this advice.

Rather, the payoff to Windows users from cultivating this forward
slash habit is that it will keep Stata from escaping what you don't
want escaped. To see what I am talking about try the command above
both ways. The last backward slash tells Stata to ignore the closing
quote. The forward slash does not.

Gabi


On 4/17/08, Kyle K. Hood <[email protected]> wrote:
> Raphael Fraser wrote:
>
> > what wrong with my syntax?
> >
> > local myfiles: dir "C:\data\kingdom\*.csv"
> >
>  The help file is difficult to decipher only because we cannot shake our DOS
> intuition.  Here is the command that you want:
>
>  local myfiles: dir "C:\data\kingdom\" files "*.csv"
>
>  *
>  *   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/
>
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index