Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: renaming path name in 100 do-files


From   Dan Blanchette <dan.blanchette@duke.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: renaming path name in 100 do-files
Date   Thu, 24 Sep 2009 11:18:09 -0400 (EDT)

Nikos Askitas (nikos@iza.org) and I have a command called -rcd-
that is available on the SSC:
 . ssc install rcd


It's a prefix command that lets you run other Stata commands.  It
cds around to as many directories as you want and runs the Stata
command.

rcd [directory_name], [verbose] [depth(integer >= 1)] [dirfilter(regular expression)] [: command]

I would think you could run -filefilter- with it by making a do-file
in one directory that will be run in all desired directories:

 . rcd "C:\my_data\" , dirfilter(".progs") : do "C:\my_data\fix_files.do"

where fix_files.do is:
  ldo
  foreach file in `r(files)' {
    filefilter `file' `file'new, from(<oldpath>) to(<newpath>)
  }

Hope this helps,

Dan Blanchette
Research Associate
Center for Entrepreneurship and Innovation
Duke University's Fuqua School of Business
dan.blanchette@duke.edu


"r.c.reulen" <r.c.reulen@gmail.com>
------------------------------------------------------------------------
Thanks for the suggestions. I failed to mention that the do-files are
in several sub (and sub-sub) folders as well, which would make the
task more complicated.....
------------------------------------------------------------------------


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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