简体   繁体   中英

How to get the list of all the files(objects) in a folder exposed by an MTP device using Windows Portable Devices C++ API?

It is possible to enumerate all the files in an MTP device's file system and then get object id's for each file/folder in the system.

My questions are:

  1. Is there a method to find if an object is a file or a folder?
  2. Once the folder is found how to get the list of all files(Objects) in it ?

I have checked the Programmer's reference page in msdn website but did not find anything relevant. Am I missing something ?

Thanks!

  1. Using IPortableDeviceValues (which you get from the IPortableDeviceProperties::GetValues() method), query for WPD_OBJECT_CONTENT_TYPE . It will return WPD_CONTENT_TYPE_FOLDER if the object is a folder.

  2. Using the IPortableDeviceContent::EnumObjects() method, you can enumerate the content of any folder objects.

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