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, statalist.org is already up and running.


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

Re: st: Post-program tempfiles or a temp directory?


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Post-program tempfiles or a temp directory?
Date   Thu, 27 Sep 2012 19:37:37 +0100

I have not tried it but I imagine that temporary files opened in an
interactive session will remain open during that session. The
interactive session itself counts in Stata as a program in the widest
sense, at least for some purposes. You would then just need to pass
their names to your individual programs.

For further and better advice, you might need to spell out what your OS is.

Nick

On Thu, Sep 27, 2012 at 7:18 PM, James Sams <sams.james@gmail.com> wrote:
> 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.
*
*   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