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?