2

An app I am debugging on an Android Galaxy Nexus creates a folder whose contents I want to inspect on my desktop. When I open a file browser app on the device, I can see the folder. However, when I connect to it from the desktop in the MTP mode, I can't see it. Nor can I see a copy of that folder that I create on the device using the file browser.

What can I do to make it visible from the desktop so that I could copy it over?

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
I Z
  • 5,719
  • 19
  • 53
  • 100

1 Answers1

3

If this is a folder you created from code, you need to use MediaConnection.scanFile() to get it to show up in MTP. I have a blog post from last year that explains a bit more.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks. I'll give it a try. if I create a folder with a bunch of files in it, is it enough to scan only the folder or do I need to scan every file to make it visible? – I Z Jun 15 '12 at 14:12
  • @IZ: Good question. I have not tried creating a folder of files that needed to be indexed. I would hope that calling `scanFile()` on the folder would suffice, but I have not tried it myself. Sorry! – CommonsWare Jun 15 '12 at 15:50
  • I just tried it. When I pass a folder path to scanFile, it seems to handle it as a file. That is, after I switch to MTP, I can navigate to the folder but it looks like a file and there is nothing underneath. Maybe I have explicitly recurse over files and subfolders and apply scanFile to each of them -- need to try that – I Z Jun 15 '12 at 16:24
  • +1 Thank you, solved a big newbie problem I was having, not seeing files I'd copied accross via the network – James Hurford Aug 04 '12 at 22:46