How to access /storage/emulated/0/
Asked Answered
D

16

47

I have written a code to record audio and save it to below file location.

private String getFilename() {
    String filepath = Environment.getExternalStorageDirectory().getPath();
    File file = new File(filepath, AUDIO_RECORDER_FOLDER);
    if (!file.exists()) {
        file.mkdirs();
    }
    return (file.getAbsolutePath() + "/" + System.currentTimeMillis() + file_exts[currentFormat]);
}

In Logcat, it gives me a file location as

/storage/emulated/0/AudioRecorder/1436854479696.mp4

I am not able to find this file location on my SD card. How to access the location?

Deponent answered 14/7, 2015 at 6:21 Comment(3)
You have to install file manger and find AudioRecorder folderRochelrochell
For people looking to access the directory externally (from eg. Android Device Monitor), see hereAllred
It is a pity this question does not specify if the files should be accessed with a phone app or a programme on a connected computer.Ruthieruthless
D
11

As Hiren stated, you'll need a file explorer to see your directory. If you're rooted I highly suggest root explorer, otherwise ES File Explorer is a good choice.

Dink answered 14/7, 2015 at 6:53 Comment(5)
Thank you. I am able to locate using bluetooth file transfer explorer. +1 for the answer.Deponent
So "File Manager" the default app to handle files on Android cannot access that folder?Brno
ES File Explorer does not show this directory for me on Android 7.Fremont
ES File Explorer was a great app but unfortunately Google removed it: androidpolice.com/2019/04/27/…Ailing
On Android 13 I cannot access this location using any file explorer I've tried (Google Files, Samsung MyFiles, SolidExplorer2). They all give a permission error.Acton
B
31

No need for third party apps

My Android 6.0 allows me to browse the intern memory without the need for third party apps. I simply do this*:

  1. "Settings"
  2. "Storage and USB"
  3. "Intern"
  4. [let it load a bit...]
  5. [scroll all the way down]
  6. "Browse"

* Words may not correspond to the standard English version ones, since I'm just freely translating them from Portuguese.

Note: At least in my phone, /storage/emulated/0 does not correspond to SD card, but to intern memory. This method did not work for my external card, but I never tried it with another phone.

Hope this helps!

Barron answered 5/10, 2016 at 17:41 Comment(2)
that is so f**ked up! In my case I can see the photos in this view... and yet when connected to USB, and viewing in Explorer I see something different under the same folder. Thanks I'd never have thought of that one.Officiate
On Android 13, this does not work for me. Settings / Battery & Device Care / Storage. Then "internal" is the only heading shown, with breakdowns of space used for images, video, etc. But no "browse" appears.Acton
C
18

Also you can use Android Debug Bridge (adb) to copy your file from Android device to folder on your PC:

adb pull /storage/emulated/0/AudioRecorder/1436854479696.mp4 <folder_on_your_PC_e.g. c:/temp>

And you can copy from device whole AudioRecorder folder:

adb pull /storage/emulated/0/AudioRecorder <folder_on_your_PC_e.g. c:/temp>
Chainplate answered 22/3, 2018 at 17:28 Comment(0)
S
12

Plug in your device and run adb shell which will get you a command shell on your device. You don't have permission to read /storage/emulated/ but since you know it's in subdirectory 0 just go cd /storage/emulated/0 and you will be able to look around and interact as aspected.

Note: you can use adb wirelessly as well

Shriver answered 3/6, 2017 at 8:38 Comment(2)
Yeah, I did the above and now I'm at the prompt 127|shell@pplus:/storage/emulated/0 $ . How am I supposed to "look around and interact as aspected"? I stumbled onto cd as a command to change directory, so I tried cd data. /system/bin/sh: cd: /storage/emulated/0/data: No such file or directory.Gailgaile
I just tried and feel 2 things might be happening. Did you do a ls and make sure data/ is in the folder. Also try /storage/emulated/1Shriver
D
11

As Hiren stated, you'll need a file explorer to see your directory. If you're rooted I highly suggest root explorer, otherwise ES File Explorer is a good choice.

Dink answered 14/7, 2015 at 6:53 Comment(5)
Thank you. I am able to locate using bluetooth file transfer explorer. +1 for the answer.Deponent
So "File Manager" the default app to handle files on Android cannot access that folder?Brno
ES File Explorer does not show this directory for me on Android 7.Fremont
ES File Explorer was a great app but unfortunately Google removed it: androidpolice.com/2019/04/27/…Ailing
On Android 13 I cannot access this location using any file explorer I've tried (Google Files, Samsung MyFiles, SolidExplorer2). They all give a permission error.Acton
V
4

Try This

private String getFilename() {
    String filepath = Environment.getExternalStorageDirectory().getPath();
    File file = new File(filepath + "/AudioRecorder" );
    if (!file.exists()) {
        file.mkdirs();
    }
    return (file.getAbsolutePath() + "/" + System.currentTimeMillis() + ".mp4");
}
Visakhapatnam answered 14/7, 2015 at 6:48 Comment(0)
R
3

In Emulator, to view this file click on Settings>Storage>Other>Android>data>com.companyname.textapp>file>Download. Here, textapp is the name of the app you are working on.

Roodepoortmaraisburg answered 30/8, 2017 at 11:8 Comment(0)
S
3

https://productforums.google.com/forum/#!msg/nexus/WIcHUNQfRLU/ALpViG86AwAJ

Mr Expensive Toys said: Am amazed that this problem is still showing up as it started happening as far back as Honeycomb.

So, the /storage/emulated/0/DCIM/Camera is the same folder as your normal DCIM/Camera folder. Its just a symlink. So the files are actually in the right location you just have an app that put bad data into the MediaStore Database.

When accessing files from your PC your are actually enumerating the MediaStorage database for files. Its not pulling a traditional directory lists. So what you see is based on what is in that database and the path entries in the database. Files in the database pointing to emulated directories aren't shown as they are assumed to be duplicates as its the same physical directory as your normal DCIM/Camera. What is going on is that some poorly written third party apps are inserting entries into the database with the /storage/emulated/0/DCIM/Camera path instead of the proper root path to DCIM/Camera. Which means that the MTP service can't see them when you are hooked up to your PC.

Usually the easiest way to fix the problem is to just clear the MediaStore databases to get the bad entries out of the MediaStore Database and let the system reindex the files and put into the database with the proper paths.

Settings->apps Hit 3 dot menu in top right and select Show System Find Media Storage, Select it, Select Storage, then Clear Data Find External Storage, Select it , Select Storage, then Clear Data Turn phone off, turn phone back on, wait for indexer service to rebuild the data.

When you are done the files should show up with proper directory tree and be visible from the PC. Depending on amount of files on the phone it can take as 10-20 minutes to rebuild the media database as the service walks the phone directories, getting meta data, creating thumbnails, etc.

Stole answered 24/1, 2018 at 4:12 Comment(0)
N
3

Android recommends that you call Environment.getExternalStorageDirectory.getPath() instead of hardcoding /sdcard/ in path name. This returns the primary shared/external storage directory. So, if storage is emulated, this will return /storage/emulated/0. If you explore the device storage with a file explorer, the said directory will be /mnt/sdcard (confirmed on Xperia Z2 running Android 6).

Numerate answered 21/2, 2018 at 13:21 Comment(1)
That's right. On Android 5.0 (Lollipop, API 21), I could get a file with adb pull /mnt/sdcard/AudioRecording.3gp . whose path was set by Environment.getExternalStorageDirectory().getAbsolutePath() + "/AudioRecording.3gp" statement.Dominickdominie
J
2

Here, it is found at /mnt/shell/emulated/0

Jughead answered 6/10, 2017 at 18:20 Comment(0)
K
1

Try it from

ftp://ip_my_s5:2221/mnt/sdcard/Pictures/Screenshots

which point onto /storage/emulated/0

Kenleigh answered 4/9, 2017 at 8:36 Comment(0)
H
1

In my case, /storage/emulated/0/ corresponds to my device's root path. For example, when i take a photo with my phone's default camera application, the images are saved automatically /store/emulated/0/DCIM/Camera/mypicname.jpeg

For example, suppose that you want to store your pictures in /Pictures directory, namely in Pictures directory which exist in root directory. So you use the below code.

File storageDir = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES );

If you want to save the images in DCIM or Downloads directory, give the below arguments to the Environment.getExternalStoragePublicDirectory() method shown above.

Environment.DIRECTORY_DCIM
Environment.DIRECTORY_Downloads

Then specify your image name :

String imageFileName = "JPEG_" + timeStamp + "_";

Then create the file object as shown below. You specify the suffix as the 2nd argument.

File image = File.createTempFile(
            imageFileName,  // prefix
            ".jpg",         // suffix
            storageDir      // directory
);
Hambletonian answered 2/1, 2018 at 9:33 Comment(0)
I
1

If you are using a simulator in Android Studio on Mac you can go to View -> Tool Windows -> Device File Explorer. Here you can use a finder-like structure.

Ingratiating answered 7/9, 2020 at 8:23 Comment(1)
It shows permission denied when trying to open the emulated folderHayrack
E
0

if you are using Android device monitor and android emulator : I have accessed following way: Data/Media/0/ enter image description here

Electrophoresis answered 5/12, 2016 at 7:7 Comment(2)
That directory is not present on all devicesDichlamydeous
Seems deprecated developer.android.com/studio/profile/monitorOverrate
I
0

To RESTORE your pictures from /storage/emulated/0/ simply open the 100Andro file..there you will see your pictures although you may not have access to them in you pc explorer. There open each picture one by one, go on setting (three dots..) and save the picture. It will show up in the android file 'Pictures' from where you can also copy them by using your explorer. There is no 'save all' function, however so it must be done one by one, but it works.

QT

Ibby answered 7/9, 2017 at 11:34 Comment(0)
C
0

View On-Device Files with Device File Explorer

https://developer.android.com/studio/debug/device-file-explorer

Crosslegged answered 1/6, 2018 at 8:26 Comment(0)
L
-4

for Xamarin Android

Using command //get the file directory

Image image =new Image() { Source = file.Path };

then in command adb pull //the image file path here

Lippizaner answered 27/2, 2017 at 12:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.