Statalist


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

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


From   raoul reulen <r.c.reulen@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: AW: renaming path name in 100 do-files
Date   Fri, 25 Sep 2009 09:28:38 +0100

Dear all,

Thank you so much for all your help. I couldnt replicate the folder
structure on my PC because the data used to be on a network with a
completely different structure. Anyway, I used the solution given by
Stefan and it worked. There were more than 300 do-files and nearly
6000 pathnames!!! To avoid any of such problems in the future I
replaced the pathname with a global which I defined in a little
program I wrote . The approach given by Dan Blanchette was very
attractive and I will look into that. Thank you all! You saved me
hours of tedious work!

2009/9/25  <Stefan.Gawrich@hlpug.hessen.de>:
> 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?
>
> As Dan Blanchette wrote, a combination of "rcd" and "filefilter" will do
> the job within Stata.
>
>
> I once solved the same task with windows search and an editor
> (Notepad++).
>
> 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 that might be favourable with "foreign"
> do-files. You have better insight in the process.
>
>
> 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/
>



-- 
-------------------------------------------------------
Raoul C. Reulen
Cancer Research UK Training Fellow

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