Read a directory

Introduction

This example shows how to use the builtin Iguana file APIs to read the files in a directory, and then to iterate through the files making a list containing various file attributes.

If you have any questions please contact us at support@interfaceware.com.

Using the Code [top]

  • Import the Read a directory channel from the Builtin: Iguana Files repository
  • Experiment with the code to find out how it works
  • Adapt the code to your own requirements

This is the github code for the main module:

How it works [top]

  • We use iguana.workingDir() to find the working directory
  •  Create a List table
  • Iterate through the directory contents and create a list of file attributes:
    • Use the os.fs.glob()  iterator function to return the name and file information for each file
    • Add an entry for each file into the List using the name and file info returned from os.fs.glob()

More information [top]

Leave A Comment?