O'Reilly logo

PhoneGap 3 Beginner's Guide by Giorgio Natili

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for Action – listing folders and files recursively

Get ready to explore the folders and their contents of the device's persistent storage. Use the following steps:

  1. Open the command-line tool and create a new PhoneGap project named FileSystem.
    $ cordova create ~/the/path/to/your/source/filesystem com.gnstudio.pg.FileSystem FileSystem
    
  2. Add the File API plugin using the command line.
    $ cordova plugins https: //git-wip-us.apache.org/repos/asf/cordova-plugin-file.git
    
  3. Go to the www folder, open the index.html file, and add a div element with the id value #fileslist inside the main div of the app, below the #deviceready one.
    <div id='fileslist'></div> 
  4. Go to the www/js folder, open the index.js file, and define a new function named requestFileSystem ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required