Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Post-program tempfiles or a temp directory?


From   James Sams <sams.james@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Post-program tempfiles or a temp directory?
Date   Thu, 27 Sep 2012 11:18:04 -0700 (PDT)

Short version: I want to create a -tempdir- that behaves like -tempfile-, only 
for directories.

I'm trying to write a program that will create lots of tempfiles that will not 
be deleted after the end of the program but will be deleted after the end of a 
stata session. The purpose of this is to work with very large data in smaller 
logical chunks in a convenient manner.

There does not seem to be any kind of flag to -tempfile- that will tell it to 
not be deleted after the end of the program run, though such a flag would be 
convenient.

Similarly, I tried setting up the program to take a temporary directory 
(created by tempfile actually_a_dir ; mkdir `actually_a_dir') and then pass the 
`actually_a_dir' to my program, have it create the files there, hoping that the 
directory would be cleaned up like a tempfile would be. However, this is not 
the case. The directory is not even cleaned on stata's exit.

If I can't manipulate tempfile to create files that will last longer, I want to 
create -tempdir- that will create a hook similar to Stata's tempfile to clean 
up the directory on the exit of the current context, or whatever exactly 
tempfile's rule is.

Thoughts?


-- 
James Sams
sams.james@gmail.com
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index