Automatically get the latest json file if only given a folder as path #33

Merged
MG-95 merged 4 commits from automatically-get-latest-file into master 2022-10-25 00:14:48 +02:00
Showing only changes of commit 2c0fdb13c7 - Show all commits

View file

@ -78,7 +78,7 @@ def main(*_args):
# we want the latest json file in given folder
filesList = [f for f in os.listdir(file_path) if os.path.isfile(os.path.join(file_path, f)) and f.endswith(".json")]
filesList.sort()
file_path = os.path.join(file_path, filesList[len(filesList) - 1])
file_path = os.path.join(file_path, filesList[-1])
else:
print("Please enter a valid json file or the directory containing the json file!")