Questions tagged [temporary-files]

A (often short lived) file, automatically created for reasons like storing data that no longer fit into memory, for inter-process communication or to save state for possible crash recovery. Many programming platforms provide means functions to work with such files easier.

A temporary file is an often short lived file, automatically created for reasons like storing data that no longer fit into memory, for inter-process communication or to save state for possible crash recovery. Many programming platforms provide means functions to work with such files easier.

917 questions
554
votes
5 answers

Can I delete data from the iOS DeviceSupport directory?

After going through and cleaning my disk with old things that I didn't need anymore, I came across the iOS DeviceSupport folder in ~/Library/Developer/Xcode which was taking nearly 20 GB. A similar question has been asked before, but since then many…
3x14
  • 5,679
  • 3
  • 10
  • 24
297
votes
17 answers

How can I create a temp file with a specific extension with .NET?

I need to generate a unique temporary file with a .csv extension. What I do right now is string filename = System.IO.Path.GetTempFileName().Replace(".tmp", ".csv"); However, this doesn't guarantee that my .csv file will be unique. I know the…
Brann
  • 29,395
  • 31
  • 107
  • 159
254
votes
12 answers

git ignore vim temporary files

What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)?
jrdioko
  • 28,317
  • 26
  • 75
  • 116
216
votes
6 answers

Creating temporary files in Android

What's the best way to create a temporary file in Android? Can File.createTempFile be used? The documentation is very vague about it. In particular, it's not clear when temporary files created with File.createTempFile are deleted, if ever.
hpique
  • 112,774
  • 126
  • 328
  • 461
198
votes
5 answers

How to create a temporary directory and get its path/ file name?

How can I create a temporary directory and get its path/file name in Python?
duhhunjonn
  • 42,933
  • 11
  • 25
  • 15
175
votes
7 answers

How to prevent vim from creating (and leaving) temporary files?

Why does vim create ~ files? Is there a way to disable that? If it's for backup (or something), I use git for that. Also, these ..swp files too. How do I tell vim not to create those, or at the least to cleanup…
hasen
  • 148,751
  • 62
  • 182
  • 223
119
votes
2 answers

What is a safe way to create a Temp file in Java?

I'm looking for a safe way to create a temp file in Java. By safe, I mean the following: Name should be unique, even under potential race conditions (e.g. another Thread calls the same func at the same time, or another process runs this code…
SRobertJames
  • 6,827
  • 12
  • 48
  • 89
116
votes
7 answers

Generate temporary file names without creating actual file in Python

The question, number 10501247, in stackoverflow gives answer how to create temporary file in Python. I only need to have temporary file name in my case. Calling tempfile.NamedTemporaryFile() returns file handle after actual file creation. Is there…
Hill
  • 2,522
  • 3
  • 18
  • 26
95
votes
6 answers

When are Java temporary files deleted?

Suppose I create a temporary file in Java with the method File tmp = File.createTempFile(prefix, suffix); If I do not explicity call the delete() method, when will the file be deleted? As an intuition, it might be when the JVM terminates, or…
Alphaaa
  • 3,716
  • 7
  • 30
  • 42
91
votes
8 answers

Removing created temp files in unexpected bash exit

I am creating temporary files from a bash script. I am deleting them at the end of the processing, but since the script is running for quite a long time, if I kill it or simply CTRL-C during the run, the temp files are not deleted. Is there a way I…
skinp
  • 3,719
  • 3
  • 24
  • 19
87
votes
3 answers

catch on swipe to dismiss event

I'm using an android notification to alert the user once a service is finished (success or failure), and I want to delete local files once the process is done. My problem is that in the event of failure - I want to let the user a "retry" option. and…
Dror Fichman
  • 1,499
  • 1
  • 13
  • 16
62
votes
9 answers

How do I automatically delete temp files in C#?

What's a good way to ensure that a temp file is deleted if my application closes or crashes? Ideally, I would like to obtain a temp file, use it, and then forget about it. Right now, I keep a list of my temp files and delete them with an…
Nifle
  • 11,285
  • 9
  • 70
  • 93
59
votes
6 answers

How to send image generated by PIL to browser?

I'm using flask for my application. I'd like to send an image (dynamically generated by PIL) to client without saving on disk. Any idea how to do this ?
user795243
57
votes
6 answers

Python - How do I convert "an OS-level handle to an open file" to a file object?

tempfile.mkstemp() returns: a tuple containing an OS-level handle to an open file (as would be returned by os.open()) and the absolute pathname of that file, in that order. How do I convert that OS-level handle to a file object? The documentation…
Daryl Spitzer
  • 121,723
  • 75
  • 151
  • 166
54
votes
1 answer

How to use tempfile.NamedTemporaryFile()?

I'm working on a Python script that needs to create about 50 distinct temporary files, which are all appended frequently during the course of the script and merged at the end. I'm sure that the tempfile module can do what I need, but I haven't been…
Gregory
  • 3,390
  • 7
  • 25
  • 41
1
2 3
61 62