Statalist


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

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


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: renaming path name in 100 do-files
Date   Thu, 24 Sep 2009 15:24:20 -0400

This was the problem that I developed -c- to solve (-ssc install fastcd- to get it).

In brief, -c- associates mnemonics with directories, and then lets you change to a directory by specifying its mnemonic. The associations are stored on a file on the computer. I've got different mnemonic-directory mappings for my home, office, and travel laptop computers, and all my do files run fine on each.

Doesn't solve the immediate problem, of course...

- NW

skolenik wrote:
I'd suggest replacing the hard coded directory name with a global
pointing to the base directory. Then you'd both be able to work on
this set of do-files by referring to the machine specific global.
(I've had something like that for years to divide the workload between
my laptop and desktop.)

On Thu, Sep 24, 2009 at 9:29 AM, r.c.reulen <[email protected]> wrote:
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.....

2009/9/24 Ulrich Kohler <[email protected]>:
Perhaps something along the following lines:

ssc install dirtools
ldo
foreach file in `r(files)' {
  filefilter `file' `file'new, from(<oldpath>) to(<newpath>)
}

Uli


Am Donnerstag, den 24.09.2009, 15:02 +0100 schrieb raoul reulen:
Dear all,

I received around 100 different do-files from a colleague, but the
path name in each do-file is different from my computer because the
do-files were on a different computer. Is there any easy way to change
the path in each do-file without having to physically open each
do-file and replace the path name?

Thanks,

Raoul




--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index