title: iterate over files in directory and use file names as variables, and assign the file path to the variable
body: <p>I was trying to iterate through a folder and get the names of files and paths of these files in DataBricks using Pyspark.
  And suddenly a thought came like if we could make the names of files as variable and assign the path to that respective file named variable.
  We could use dbutils to create widgets and assign the file name as parameter, to make things easier.
  So working on this process I came till obtaining the paths of files and filenames.
  But I couldn't figure out the variable creation and assigning the paths of the respective files in the respective file name variables
  Here's the code :</p>
  
  <pre><code>import pandas as pd
  import os
  list1 =[]
  list2 =[]
  directory='/dbfs/FileStore/tables'
  dir='/FileStore/tables'
  for filename in os.listdir(directory):
    if filename.endswith(".csv") or filename.endswith(".txt"):
      file_path=os.path.join(dir, filename)
      print(file_path)
      print(filename)
      list1.append(file_path)
      list2.append(filename)
  </code></pre>
  
  <p>Thanks in advance</p>