title: How to transfer files from Android device to PC using USB and/or WPD
body: <p>I am trying to connect an android device to a (Windows 7 64bit) PC via cable, and then to retrieve some files from android to pc programmatically. </p>
  
  <p>(Note: I need this for a specific device, Moverio BT-200, and I am having drivers issues with that; so <em>please</em> don't suggest to use adb ;-) I know that's the easy and fast way, but it's not feasible)</p>
  
  <p>I have found that my device can be seen as a Windows Portable Device (<a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd388998%28v=vs.85%29.aspx" rel="nofollow">WPD</a>). I found some really good code examples in C# that enables me to <a href="http://cgeers.com/2011/05/22/enumerating-windows-portable-devices/" rel="nofollow">detect WPDs</a>, to <a href="http://cgeers.com/2011/06/05/wpd-enumerating-content/" rel="nofollow">enumerate their contents</a>, and to <a href="http://cgeers.com/2011/08/13/wpd-transferring-content/" rel="nofollow">transfer the contents</a>. I also found some code in C++, which does <a href="https://code.msdn.microsoft.com/Portable-Devices-COM-API-fd4a5f7d#content" rel="nofollow">all of the above and much more</a>. All of this examples works like a charm as long as I connect a single sdcard, or a usb key (that is: as long as I have a device which gets recognized by Windows and gets a letter as a proper drive), and I get a full list of the present files, with their absolute paths. However, if I try to connect an android devices, and to list the contents, I get something that I do not understand:</p>
  
  <pre><code>embt2
  SD Card
  o15F9A
  o15F9B
  o15F9C
  o15F9D
  o15F9E
  ...etc
  Internal Storage
  o1
  o2
  o3
  o4
  o5
  o6
  oD1F
  oD20
  oD24
  o7
  o8
  o1E78
  o9
  ...etc
  </code></pre>
  
  <p>How can that be? Browsing the C# code (second link, above), I found that at some points, the code creates several GUID objects, each with some slightly different parameters:</p>
  
  <pre><code>// Identify the property to retrieve
  var property = new _tagpropertykey();
  property.fmtid = new Guid(0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B,
                                        0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC);
  property.pid = 12;
  
  [...]
  
  // Get the name of the object
  string name;
  var property = new _tagpropertykey();
  property.fmtid = new Guid(0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC,
                                    0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C);
  property.pid = 4;
  
  [...]
  
  // Get the type of the object
  property = new _tagpropertykey();
  property.fmtid = new Guid(0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC,
                                    0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C);
  property.pid = 7;
  
  [...]
  
  var folderType = new Guid(0x27E2E392, 0xA111, 0x48E0, 0xAB, 0x0C,
                                    0xE1, 0x77, 0x05, 0xA0, 0x5F, 0x85);
  var functionalType = new Guid(0x99ED0160, 0x17FF, 0x4C44, 0x9D, 0x98,
                                        0x1D, 0x7A, 0x6F, 0x94, 0x19, 0x21);
  </code></pre>
  
  <p>But I couldn't figure out how these exadecimal values work. The documentation online seems scarce. I found my device guid with the Device Manager (<code>{eec5ad98-8080-425f-922a-dabf3de3f69a}
  </code>), but everytime I tried to replace one of these guid with my own, I got a COMException.</p>
  
  <p>Am I looking in the right place? Do I need to set some GUID, or something else? </p>
  
  <p>I am tagging this question as C# and C++ because I found some code examples in these two languages, but I am willing to solve the problem in any language (java, python, ... )</p>