Statalist


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

st: renaming path name in 100 do-files


From   Stefan.Gawrich@hlpug.hessen.de
To   statalist@hsphsun2.harvard.edu
Subject   st: renaming path name in 100 do-files
Date   Fri, 25 Sep 2009 09:21:20 +0200

Raoul wrote:
> 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?



I once had the same task to do and used windows search and an editor
(Notepad++) to solve it. 

1. Search for "*.do"-files in the given directory (including
subdirectories).
2. Mark results (exlude unwanted results manually if needed)
3. Open files in editor (context menu -> "open with") (Notepad++ had no
problem with >100 files)
4. Search and replace string in all open files
5. Save all files (with one click in Notepad ++)

This only takes a few minutes.
It's a manual approach but compared to some automatic script gives
better insight in the process to spot possible errors.


Best wishes 
Stefan Gawrich






*
*   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