Statalist


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

Re: st: RE: two questions about the shell command behavior -- Windows XP


From   "Gabi Huiber" <[email protected]>
To   [email protected]
Subject   Re: st: RE: two questions about the shell command behavior -- Windows XP
Date   Mon, 8 Dec 2008 18:30:15 -0500

That's it. Thank you, Kieran.

I'm sure that the culprit is not the underscore. The double backslash
must have done the job. You need to 'escape the escape' as it were.

Gabi

On Mon, Dec 8, 2008 at 6:05 PM, Kieran McCaul
<[email protected]> wrote:
> I've removed the underscores in the to and from paths and also from the
> file name.
> I think this works.
> Note the double slashes at the end of the to_path and from_path macros
> and the space after `move_this' in the -move- line.
>
> clear
> set more off
>
> local root      "c:/work/my root directory/"
> local to_path   "to here\\"
> local from_path "from here\\"
> local move_this "example list.txt"
>
> cd "`root'"
>
> !move "`from_path'`move_this' " "`to_path'`move_this'"
> dir "`from_path'"
> dir "`to_path'"
>
>
>
> ______________________________________________
> Kieran McCaul MPH PhD
> WA Centre for Health & Ageing (M573)
> University of Western Australia
> Level 6, Ainslie House
> 48 Murray St
> Perth 6000
> Phone: (08) 9224-2140
> Fax: (08) 9224 8009
> email: [email protected]
> http://myprofile.cos.com/mccaul
> _______________________________________________
> The fact that no one understands you doesn't make you an artist.
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Gabi Huiber
> Sent: Tuesday, 9 December 2008 6:52 AM
> To: [email protected]
> Subject: st: two questions about the shell command behavior -- Windows
> XP
>
> Hello everybody,
>
> I need to make room on a disk and I thought I'd do this on an ongoing
> basis from within a larger Stata process that runs every day. So I
> need to move files around. I thought that this prototype would get me
> started:
>
> clear
> set more off
>
> local root      "c:/work/my root directory/"
> local to_path   "to_here\"
> local from_path "from_here\"
> local move_this "example_list.txt"
>
> cd "`root'"
>
> !move `from_path'`move_this' `to_path'`move_this'
> dir "`to_path'"
> dir "`from_path'"
>
> !move `from_path'example_list.txt `to_path'example_list.txt
> dir "`to_path'"
> dir "`from_path'"
>
> I have two questions about the shell command:
>
> 1. The shell modifier (shell or !) seems to pass along the local
> macros with the immediate folder names -- `from_path' and `to_path' --
> but it does not do the same with the local macro that holds the file
> name. It would be nice if it did, because local macros that hold file
> names would make it a lot easier to loop across multiple file name
> variants. Does anybody know what explains this selective treatment of
> local macros?
>
> 2. The shell modifier does not allow me to enclose file path or file
> name macros in quotes in order to accommodate spaces. In this case I
> cd'd into the `root' path and the very last folders of interest had no
> spaces, but I won't always be so lucky. Does anybody know of a
> workaround?
>
> 3. This is more an idle puzzle than a real issue, though it might grow
> into one. When I started using forward slashes in Stata, I thought I
> could do so because Windows didn't care either way. But it does. The
> XP command prompt does not recognize forward slashes. So it's very
> nice of Stata to make that problem go away, especially if you have
> folder names whose first character, when paired with a backslash,
> could be mistaken for a special character. I guess, though, that Stata
> can only go so far in offering this convenience. You have to
> relinquish it when you invoke the shell, it seems. Too bad, but not
> critical.
>
> But issues (1) and (2) are nuisances, and they are strange. Inside
> Stata you can string along as many macros as you want, so (1) should
> not be an problem; and you can use quotes to declare file paths with
> spaces in them both inside Stata and at the Windows command prompt, so
> (2) shouldn't be one either.
>
> Thank you,
>
> Gabi
> *
> *   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