0

I am trying to move files from one path to another, the destination path needs to support portable devices like android phones.

After discovering FolderBrowserDialog does not support portable devices I found this blog that explains how to use Shell32 and COM-Objects.

The problem is that I need to store the path (string) and load it back (from file) as Folder object, the method on doing so is to use the shell method shell.NameSpace(path). That's only works with system paths, otherwise it will return null:

 shell = new Shell();
 Folder folder = shell.BrowseForFolder((int) Handle, "Select folder", 0, 0);
 Folder folderFromPath = shell.NameSpace((folder as Folder3).Self.Path);
 //folderFromPath is null if I choose android device folder.

While this works:

Folder folderFromPath = shell.NameSpace("C:\\Program Files");
 //folderFromPath is not null

Is there another way of doing it?

cnc
  • 23
  • 8

2 Answers2

0

So apparently my android device generate this path: ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_2717&pid_ff40#329682240804#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,54091657216}\{46DD6D4D-0000-0000-0000-000000000000}

Passing this path to shell.NameSpace method didn't work, but for some unknown reason removing SID-{10001,,54091657216} part made it work.

I really don't know what this part mean (though it's the reference for the internal storage of the device), which devices generate it and moreover, why nobody else posted about.

But if anyone else comes across this, I hope this will help :).

cnc
  • 23
  • 8
0

This USB\VID_2717&PID_FF40 refers to Mi/Redmi series (MTP) which means the devices is a Mobile Device and connected as Media Transfer Protocol (MTP). Now, if someone is trying to Copy using the CopyHere approach, he can resolve this. Therefore, instead of using simply moving data or using MoveHere, use CopyHere. Hope this will be added information as well :-)

Rizwan Ranjha
  • 380
  • 3
  • 4
  • 16