temporary-files

How can I automatically create (and remove) a temp directory in a Makefile?

安稳与你 提交于 2019-12-05 01:30:01
Is it possible to have make create a temp directory before it executes the first target? Maybe using some hack, some additional target etc.? All commands in the Makefile would be able to refer to the automatically created directory as $TMPDIR , and the directory would be automatically removed when the make command ends. paxdiablo I seem to recall being able to call make recursively, something along the lines of: all: -mkdir $(TEMPDIR) $(MAKE) $(MLAGS) old_all -rm -rf $(TEMPDIR) old_all: ... rest of stuff. I've done similar tricks for making in subdirectories: all: @for i in $(SUBDIRS); do \

Can't delete temporary files after returning FileStream

梦想与她 提交于 2019-12-04 22:28:20
问题 I have a function in a C# MVC application that creates a temporary directory and a temporary file, then opens the file using FileStream, returns the FileStream to a calling function, and then needs to delete the temporary files. However, I do not know how to delete the temp directory and file because it always errors out saying "the process cannot access the file because it is being used by another process." This is what I tried, but the FileStream is still using the temp file in the finally

How can I copy a file content into a temporary file in PHP? [duplicate]

一个人想着一个人 提交于 2019-12-04 19:06:10
问题 This question already has answers here : How to get a temporary file path? (5 answers) Closed 5 years ago . I tried this: $temp = tmpfile(); file_put_contents($temp,file_get_contents("$path/$filename")); But I get this error: "Warning: file_put_contents() expects parameter 1 to be string," If I try: echo file_get_contents("$path/$filename"); It return to screen the file content as a long string. Where am I wrong? 回答1: tmpfile() creates a temporary file with a unique name in read-write (w+)

tmpfile() on windows 7 x64

拜拜、爱过 提交于 2019-12-04 17:08:47
Running the following code on Windows 7 x64 #include <stdio.h> #include <errno.h> int main() { int i; FILE *tmp; for (i = 0; i < 10000; i++) { errno = 0; if(!(tmp = tmpfile())) printf("Fail %d, err %d\n", i, errno); fclose(tmp); } return 0; } Gives errno 13 (Permission denied), on the 637th and 1004th call, it works fine on XP (haven't tried 7 x86). Am I missing something or is this a bug? A bit of a refresher from the manpage of on tmpfile() , which returns a FILE* : The file will be automatically deleted when it is closed or the program terminates. My verdict for this issue: Deleting a file

Why doesn't tempfile.SpooledTemporaryFile implement readable, writable, seekable?

假如想象 提交于 2019-12-04 07:37:22
In Python 3.6.1, I've tried wrapping a tempfile.SpooledTemporaryFile in an io.TextIOWrapper: with tempfile.SpooledTemporaryFile() as tfh: do_some_download(tfh) tfh.seek(0) wrapper = io.TextIOWrapper(tfh, encoding='utf-8') yield from do_some_text_formatting(wrapper) The line wrapper = io.TextIOWrapper(tfh, encoding='utf-8') gives me an error: AttributeError: 'SpooledTemporaryFile' object has no attribute 'readable' If I create a simple class like this, I can bypass the error (I get similar errors for writable and seekable ): class MySpooledTempfile(tempfile.SpooledTemporaryFile): @property def

File upload with WinSCP .NET/COM with temporary filenames

北慕城南 提交于 2019-12-04 07:26:57
I am creating a small .NET application in C# to upload files to an FTP Server. I am using the .NET DLL for WinSCP while doing this and i have been trying to find a good solution to my problem. The FTP folder where I will put all my files will be monitored by another application. This application will then take these files and process them automatically. So what I want to avoid is that my files are grabbed by the application before the transfer is complete. So I want to use either temporary filename usage or maybe a temporary folder and then move the files when upload is finished. What do you

How to move location of Atomikos's tm.out and *.epoch files?

江枫思渺然 提交于 2019-12-04 04:45:08
I'm running a J2SE application that uses Atomikos which dumps it's numerous log files to the current directory. I'd like to move the location of these files to "/tmp", but I cannot locate a configuration property that I can set from within my Spring XML config file. The Atomikos documentation references a property: com.atomikos.icatch.output_dir Which seems exactly what I need, but how to set from Spring it without a jta.properties file? Here is my transaction manager config: <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name=

How to create a temporary file (for writing to) in C#? [duplicate]

对着背影说爱祢 提交于 2019-12-04 02:52:29
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Creating tempory folders I'm looking for something like the tempfile module in Python: A (preferably) secure way to open a file for writing to. This should be easy to delete when I'm done too... It seems, .NET does not have the "batteries included" features of the tempfile module, which not only creates the file, but returns the file descriptor (old school, I know...) to it along with the path. At the same time,

Using tempfile to create pdf/xls documents in flask

偶尔善良 提交于 2019-12-04 02:21:44
问题 I wanted to ask if it's possible to create PDF/XLS documents as temporary files. I'm doing that to send them using flask afterwards. For pdf/xls files creation I use reportlab and xlsxwriter packages respectively. When I save document using their methods, I get the "Python temporary file permission denied" error. When I try to close using the tempfile methods, files become corrupted. Is there any way to overcome this? Or any other suitable solution? EDIT: Some code snippets: import xlswriter

What is the equivalent of ExternalResource and TemporaryFolder in JUnit 5?

两盒软妹~` 提交于 2019-12-04 01:53:53
According to the JUnit 5 User Guide , JUnit Jupiter provides backwards compatibility for some JUnit 4 Rules in order to assist with migration. As stated above, JUnit Jupiter does not and will not support JUnit 4 rules natively. The JUnit team realizes, however, that many organizations, especially large ones, are likely to have large JUnit 4 codebases including custom rules. To serve these organizations and enable a gradual migration path the JUnit team has decided to support a selection of JUnit 4 rules verbatim within JUnit Jupiter. The guide goes on to say that one of the rules is