Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Creating a folder with time and date


From   "Rodrigo Martell" <[email protected]>
To   <[email protected]>
Subject   st: Creating a folder with time and date
Date   Mon, 21 Aug 2006 13:23:54 +1000

Hi all,
 
I've written a program that, among a whole lot of other things, logs some output. I instruct the user to create a folder in (the fairly generic location of) her C drive, in C:/, called "RMTestResults". I'm wondering if anyone knows some code (if there is some) to automatically create this folder and tag it with the time and date. Perhaps maybe also tag it with a short description set by the user. For example, create a folder in C:/ with name "RMTestResults-Aug-21-06 1:20pm Run 1" (where Run 1 was specified by the user before executing the program) and save the log of the results there.
 
My current code looks something like this (using V9 of Stata):
 
-------------------------------------------------------------------------------------------------------------------------------
syntax **stuff here for time series*** [, **options here** **perhaps some text input command here to execute the macro in the folder tagging line?***]
 
***Program code for other stuff here ****
log using "C:\RMTestResults\Results_of_RM_Test", append

log close

log using "C:\RMTestResults\Results_of_RM_Test", replace

***code that does stuff here****

log close

**** more code here****

end

---------------------------------------------------------------------------------------------------------------------

Btw: the reason I have an append and replace on the same log is that I want to create the folder if it's not there and I want to replace its contents with the current run's results if it's already there ( the replace option didn't create a new folder when I tried it so I preceded it with an append run first)

I suspect I'll have to type something in the syntax line at the top of my program to accept a user's description of the folder but I have no idea how to write code to create and tag a folder with date/time and description. 

I also realize that this (saving on the C drive) will only work on Windows because Macs don't have a "C" drive, the generic name I believe is "Macintosh HD" and the path conventions are a bit different. I think Macs use \ instead of /, etc. Anyway, that's not too much of a problem.

If anyone has any ideas I'd greatly appreciate them sharing them with me.

Many thanks,

Rodrigo


Rodrigo Martell

 <http://www.frontier-economics.com> 	
Frontier Economics Pty. Ltd.
395 Collins Street
Melbourne VIC 3000
Australia
www.frontier-economics.com 	
switch:
direct:
fax:
mobile:
email:


+61 (0)3 9620 4488
+61 (0)3 9613 1518
+61 (0)3 8614 2711
+61 (0)407 909 811
[email protected] <mailto:[email protected]> 


This e-mail, including any attachments, may contain confidential and privileged information for the sole use of the intended recipient(s). Any review, use, disclosure or distribution by others is strictly prohibited. If you are not the intended recipient (or authorised to receive information for the recipient), please contact the sender by reply e-mail and delete all copies of this message. Thank you.

	



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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