Python File with Zip – Created Yesterday
Look for file and folder created yesterday The python script below gets the newest file and directory created yesterday. The file and directory must match a pattern. The file and…
Look for file and folder created yesterday The python script below gets the newest file and directory created yesterday. The file and directory must match a pattern. The file and…
import os import datetime import re def get_newest_in_current_day(path): current_day_files = [] current_day_dirs = [] current_day = datetime.datetime.now().day pattern = re.compile(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z(\.pbm\.json)?$") for name in os.listdir(path): # Skip names that do not…
Version 2
With a loop
from pymongo import MongoClient uri = "mongodb://localhost:27017" # Replace with your MongoDB connection URI client = MongoClient(uri) db_name = "your_database_name" # Replace with your database name db = client[db_name] current_write_concern…