Where is the temp folder located on Android phones?
Asked
Active
Viewed 1e+01k times
45
-
What do you mean by temp folder, generally Android applications have their own isolated storage provided by the system. What are you storing in a 'temp' folder? – Quintin Robinson Mar 02 '10 at 16:31
-
It might be good to migrate this question to https://android.stackexchange.com – pevik Jan 17 '18 at 05:39
-
@pevik No, because we are talking about file-only temp directories. Something that is used in development. – Gaurav Mall Aug 25 '19 at 08:46
-
@GauravMall but https://android.stackexchange.com/ is IMHO also for development. At least there are similar questions. – pevik Aug 26 '19 at 16:50
-
@pevik Well, could be. Anyways I don't agree. That's okay you can have a different opinion on the matter :) – Gaurav Mall Aug 26 '19 at 18:06
4 Answers
37
The temporary directory is /data/local/tmp
.
I've seen some comments that claim you need to be rooted to access it but I'm not sure that's true. Whilst it is true that you need root to freely access /data
, this is not required for /data/local/tmp
.
I have verified this on Android 5.1.1.

starfry
- 9,273
- 7
- 66
- 96
-
2Tested on Android 4.x and 7.x and on both it's working fine. It's possible to create subdirectories (using `adb shell`) and store screenshots in that temp directory and then pull them from the device using `adb`. Tested on non-rooted devices. – David Ferenczy Rogožan Dec 01 '17 at 14:02
-
14
I believe what you're looking for is getCacheDir()!

Hein du Plessis
- 3,305
- 6
- 34
- 51
-
10cache ≠ tmp, caches are useful to store around, whereas temp files are meant to be deleted. – Alexander Jul 07 '14 at 19:48
-
Android has the functions File.createTempFile() and File.createTempDirectory(), but they also create files in Context.getCacheDir() – lexa-b Sep 28 '17 at 09:40
-
10
Reading this post from the android developers google group leads me to believe that there is not 1 global temp directory, and each application is expected to maintain their own temporary files.

snctln
- 12,175
- 6
- 45
- 42
-
8
-
See here: https://www.quora.com/Where-should-I-find-temp-files-in-Android-mobiles – JFreeman Feb 19 '19 at 05:43
2
The files downloaded using createTempFile()
are stored in folder:
/data/data/YOURapp/cache/

Phil Dukhov
- 67,741
- 15
- 184
- 220

tariq101
- 127
- 2
- 6