Created
October 20, 2022 21:22
-
-
Save victormurcia/54bd72af05c3cbed9fd21868a7bdcde8 to your computer and use it in GitHub Desktop.
get files in directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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