Skip to content

Instantly share code, notes, and snippets.

@victormurcia
Created October 20, 2022 21:22
Show Gist options
  • Select an option

  • Save victormurcia/54bd72af05c3cbed9fd21868a7bdcde8 to your computer and use it in GitHub Desktop.

Select an option

Save victormurcia/54bd72af05c3cbed9fd21868a7bdcde8 to your computer and use it in GitHub Desktop.
get files in directory
def getListOfFiles(rPath , fType):
"""
Args:
rPath: (str) path to file
fType: (str) type of file to look for (i.e., .mp4, .json, etc.)
Returns:
lFiles: (list) List of files in rPath of type fType
"""
#1. Establish the current working directory
directory = os.getcwd()
#2. List all files in rPath of type fType
lFiles = glob.glob(directory + rPath + "\*" + fType)
return lFiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment