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 on April 23, and its replacement, 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 <>
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 

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.


James Sams
*   For searches and help try:

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