Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepypeanut authored Jan 29, 2024
1 parent 34dc192 commit 11b4606
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions JSONcombiner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#JSONCombiner.py
#if running twice in same day, make sure to

import os
import json
from datetime import datetime

folder_path = "Files"

# List all files in the folder
files = os.listdir("Files")

python_objects = []


# Loop through each file
for file_name in files:
# Check if it's a file (not a subdirectory)
if os.path.isfile(os.path.join(folder_path, file_name)) and file_name.endswith('.json'):
# Process the file as needed
print(f"Processing file: {file_name}")

# Example: Read the content of the file
with open(os.path.join(folder_path, file_name), 'r') as file:
python_objects.append(json.load(file))

# Dump all the Python objects into a single JSON file.
with open(os.path.join(f"combined_{datetime.now().strftime('%Y-%m-%d')}.json"), "w") as f:
json.dump(python_objects, f, indent=4)

0 comments on commit 11b4606

Please sign in to comment.