title: Python code to read all the files under a folder in AWS Lambda package
body: <p>I am trying to read all the files which are present under a folder in AWS Lambda package using python code.
  In local code I was able to achieve it by:</p>
  <pre><code>l_files = os.listdir(path)
  </code></pre>
  <p>For reading the files from AWS Lambda, tried the code as below:</p>
  <pre><code>with importlib.resources.files(folder_name) as files:
      l_files = os.listdir(files)
  </code></pre>
  <p>But this is throwing error as attribute 'files' doesnot exist.</p>
  <p>Is there a way by which we can read all the files present under a folder in a lambda package.</p>
  <p><strong>Update</strong></p>
  <p>I again tried the code as below</p>
  <pre><code>with importlib.resources.contents(directory_name) as config:
      print(config)
  </code></pre>
  <p>But this resulted in error: &quot;__ enter __&quot;</p>
  <p>Thanks in advance for the helps</p>