Programmatic access to phone’s SD card through Windows

  android, android-sdcard, python, win32com, windows

I recently asked a question around an automatic data synchronizing/backup script I made which worked everywhere, but failed at the phone barrier since the MTP standard hindered simple programmatic file access. (old question is here)
The issue has since morphed to a question about Windows functions and phone access, so I am reformulating it more precise here.

The way phones are connected, it is not usually possible to simply copy a path to a phone’s file destination, but I experimented and got around this issue with an on-phone server which I could map to a drive letter on Windows. Sadly, without rooting the phone, such a server also only allows internal memory access, but my aim is only the SD card. (of course I could take it out, but that is bothersome and I am ambitious to finish this)

On a second approach I used win32gui and win32com modules successfully to get away from the tkinter method and summon Windows shell functions instead. Now I can actually see the connected phone as a selectable, which tkinter failed at:
enter image description here

However, selecting the SD in this context is completely ignored, as no path to destination is extracted. No real surprise here, since the device is once again not mapped to a drive letter.
So I thought, since Windows is able to copy-paste information onto the device anyway whenever I do it by hand, there still must be some intrinsic Windows method that facilitates the procedure. After all, when I press ‘copy’, something in the background must define the address in some way for it to arrive.

Does anyone understand what lever must be pulled for Windows to go about this with proper protocol? How does it even define the path to destination for android to read when it seems illegal in most circumstances to do so?

Source: Windows Questions

LEAVE A COMMENT