简体   繁体   中英

Programmatically access files in a device showing up in 'This PC'

I am on Windows 10. I want to write a function (in R ) to copy the files stored in a camera (actually in the SD of the camera, but I cannot just read the memory card in the PC), to a different storage unit (say, the pc or an external HDD).

The camera is connected to the PC via an USB cable.

The problem I am facing is that, when opening the File Explorer, the camera is showing up as a link under "This PC" with no letter to indicate the drive (eg, 'G:/').

While I can see the files using the file explorer window, I cannot find a way to get to those file from a cli type of interface (eg, the command prompt, or the R console).

Googling, I found that 'This PC' is not a folder but rather a link to something in the registry called CLSID for which the identifier should be {20D04FE0-3AEA-1069-A2D8-08002B30309D} . However this is very confusing to me and I cannot figure out how to use this information.

Is there a way to do it? And if so: how?

Please consider I do not know much of commands from prompt (way better off in R).

A CLSID is just a GUID. My computer is a implementation of IShellFolder .

My Computer is part of the shell namespace. Several entries in the shell namespace are virtual (Control panel, scheduled tasks etc.) and cannot be accessed with low-level file functions nor cmd.exe.

While it would be possible to develop a tool that does something like shellcopy Computer\MyCamera\*.jpg x:\backup , I'm not aware of any existing tools that do this. You might have to code it yourself.

In the old days you would call SHGetDesktopFolder to get the root and then use the returned IShellFolder to navigate but these days it is simpler to use IShellItem instead.

To do this it is crucial to understand how IShellFolder and PIDLs work. See Introduction to the Shell Namespace for more information...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM