Statalist


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

Re: st: Possible to change the working directory automatically (for instances when work is done on different computers)?


From   Anna Reimondos <[email protected]>
To   [email protected]
Subject   Re: st: Possible to change the working directory automatically (for instances when work is done on different computers)?
Date   Thu, 18 Jun 2009 13:52:52 +1000

Dear Mike & Kieran,
Thank you both for your quick replies and solutions. This was exactly
what I wanted. It will make my life much simpler!


Thanks so much

Anna

On Thu, Jun 18, 2009 at 1:40 PM, Mike Wazowski<[email protected]> wrote:
> ugh, something went wrong with first reply, anyway, kieran's solution is more elegant, but for the sake of completeness:
>
> type
>
> cret list
>
> you have a bunch of system values stored there, for example i have:
>
>                  c(os) = "Windows"
>               c(osdtl) = "64-bit"
>        c(machine_type) = "PC (64-bit x86-64)"
>           c(byteorder) = "lohi"
>            c(username) = "mike"
>
>
> if any value is different between the two computers, you could code something like
>
> if c(username)=="mike" {
>  di "home computer"
>  cd ....
> }
> else {
>  di "work computer"
>  cd ....
> }
>
>
>
> --- On Thu, 6/18/09, Anna Reimondos <[email protected]> wrote:
>
>> From: Anna Reimondos <[email protected]>
>> Subject: st: Possible to change the working directory automatically (for instances  when work is done on different computers)?
>> To: [email protected]
>> Date: Thursday, June 18, 2009, 3:24 AM
>> Hello,
>> I work from my office, but nearly everyday I take things
>> home to do as
>> well using an external hard drive. The setup of the folders
>> on the
>> external harddrive is exactly the same as on my work
>> computer, but
>> obviously the full pathname is different.
>>
>> Whenever I use STATA I usually open of the program, then
>> open the
>> do-file I am working on. At the top of the do file, the
>> first thing
>> that is written is a change directory command "cd
>> *******\Project_1"
>> , and then there are commands to read in the data and so
>> on.
>>
>> At the moment I have two cd commands written on each
>> do-file one under
>> each other. One refers to the work pathname, and one refers
>> to the
>> home one.
>>  If I am at work I run only the work cd command, and if I
>> am at home
>> the work one. This works reasonably well but it is annoying
>> that I
>> can't ever run the whole do file because I first have to
>> check that
>> the correct cd command is written. Also sometimes the
>> external
>> harddrive goes in different usb slots, which messes up the
>> pathname
>> system.
>>
>> My question is: Is there any way to set the working
>> directory to the
>> one where the do-file came from, without explicitly stating
>> the
>> pathname ?
>> Does anyone else have a good system that works from them if
>> they
>> frequently work on different computers?
>>
>> Cheers
>> Anna
>> *
>> *   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/
>>
>
>
>
>
>
> *
> *   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/
>

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