Rodrogo wrote:
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.
-----------------------------------------------------
These commands will create a folder with the current date and time
included in the name:
local D = c(current_date)
local T = c(current_time)
local T = subinstr("`T'",":","_",.)
cd C:\
mkdir "`D' `T'"
cd "`D' `T'"
c(current_time) creates time in the format hh:mm:ss, and wontdow does
not allow : in file and folder names, hence the replacement.
Hope this helps
Svend
__________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone: +45 8942 6090
Home: +45 8693 7796
Email: [email protected]
__________________________________________
*
* 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/