locked
how to scan and enum files in any folder? RRS feed

  • Question

  • I want to develop a boolshelf for some types files, like pdf\txt\doc or others.

    So I need api for scan file in any folder, not only in "Document Library". Because the files maybe are stored in SDcard, I need permission to access any folder.

    Now, I know scan "Document Library" as follows (Java Script):

        Windows.Storage.KnownFolders.documentsLibrary.getItemsAsync().then(function (items){});

    But I did not find the api for scan the files in folder user-defined. dose winRt have the interface for developers?

    PS: No File picker!!


    • Edited by robert_liu Tuesday, January 10, 2012 9:00 AM
    Tuesday, January 10, 2012 8:58 AM

Answers

  • Hi Robert,

    Given your restrictions there is no way to do this. The closest you can get is to use a FolderPicker to ask the user to select the folder to scan.

    Metro style apps have access only to their own isolated storage, library locations requested via capabilities, and user selected files/folders selected via the FilePicker and FolderPicker classes.

    --Rob

    Tuesday, January 10, 2012 7:39 PM
    Moderator
  • There is also a capability specifically for RemovableStorage, so that option is available in addition to DocumentsLibrary (and music, videos, pictures); this addresses teh SD card scenario. But otherwise you have to use the FolderPicker as Rob says, because there is no API that accepts an arbitrary folder name.
    • Marked as answer by Jie Bao Tuesday, February 7, 2012 6:11 AM
    Tuesday, January 10, 2012 11:52 PM

All replies

  • Hi Robert,

    Given your restrictions there is no way to do this. The closest you can get is to use a FolderPicker to ask the user to select the folder to scan.

    Metro style apps have access only to their own isolated storage, library locations requested via capabilities, and user selected files/folders selected via the FilePicker and FolderPicker classes.

    --Rob

    Tuesday, January 10, 2012 7:39 PM
    Moderator
  • There is also a capability specifically for RemovableStorage, so that option is available in addition to DocumentsLibrary (and music, videos, pictures); this addresses teh SD card scenario. But otherwise you have to use the FolderPicker as Rob says, because there is no API that accepts an arbitrary folder name.
    • Marked as answer by Jie Bao Tuesday, February 7, 2012 6:11 AM
    Tuesday, January 10, 2012 11:52 PM
  • thank you very much, rob!
    • Edited by robert_liu Wednesday, January 11, 2012 2:29 AM
    Wednesday, January 11, 2012 2:27 AM
  • thank you very much!
    Wednesday, January 11, 2012 2:29 AM