Checking directories for .pgp files This script checks specific directories for *.pgp files. It returns a list of the filenames and modified dates. It then returns a list of the filenames and modified dates, each on a new line. I'm new to Python, like literally two weeks now and this script was written for a specific work purpose, but I'm betting it could be tweaked.

import glob
import os
from datetime import datetime


monitor_files = []

os.chdir("/home/skeer/Documents/Projects/Python_temp/home/adr01/upload/")
for file in glob.glob("*.pgp"):
    if os.path.isfile(file):
        last_modified_date = datetime.fromtimestamp(os.path.getmtime(file))
    else:
        last_modified_date = datetime.fromtimestamp(0)
    monitor_files.append("adr01 | " + file + (" | ") + str(last_modified_date) + "\n")

os.chdir("/home/skeer/Documents/Projects/Python_temp/home/chpt/upload/")
for file in glob.glob("*.pgp"):
    if os.path.isfile(file):
        last_modified_date = datetime.fromtimestamp(os.path.getmtime(file))
    else:
        last_modified_date = datetime.fromtimestamp(0)
    monitor_files.append("chpt | " + file + (" | ") + str(last_modified_date) + "\n")

os.chdir("/home/skeer/Documents/Projects/Python_temp/home/emb01/upload/")
for file in glob.glob("*.pgp"):
    if os.path.isfile(file):
        last_modified_date = datetime.fromtimestamp(os.path.getmtime(file))
    else:
        last_modified_date = datetime.fromtimestamp(0)
    monitor_files.append("emb01 | " + file + (" | ") + str(last_modified_date) + "\n")

os.chdir("/home/skeer/Documents/Projects/Python_temp/home/exp01/upload/")
for file in glob.glob("*.pgp"):
    if os.path.isfile(file):
        last_modified_date = datetime.fromtimestamp(os.path.getmtime(file))
    else:
        last_modified_date = datetime.fromtimestamp(0)
    monitor_files.append("exp01 | " + file + (" | ") + str(last_modified_date) + "\n")

os.chdir("/home/skeer/Documents/Projects/Python_temp/home/iix01/upload/")
for file in glob.glob("*.pgp"):
    if os.path.isfile(file):
        last_modified_date = datetime.fromtimestamp(os.path.getmtime(file))
    else:
        last_modified_date = datetime.fromtimestamp(0)
    monitor_files.append("iix01 | " + file + (" | ") + str(last_modified_date) + "\n")

print("\n".join(monitor_files))
Some improvement (DRY - Don't Repeat Yourself):

import glob
import os
import os.path                    # another import
from datetime import datetime

monitor_files = []

# Instead of your 5-time repetition then use this part:

PREFIX = "/home/skeer/Documents/Projects/Python_temp/home"
subdirs = ["chpt", "adr01", "emb01", "exp01", "iix01"]       # We will loop over these
UP = "upload"
PATTERN = "*.pgp"

for sd in subdirs:
    full_path = os.path.join(PREFIX, sd, UP)        # Inteligent joining of path's parts
    os.chdir(full_path)
    for file in glob.glob(PATTERN):
        if os.path.isfile(file):
            last_modified_date = datetime.fromtimestamp(os.path.getmtime(file))
        else:
            last_modified_date = datetime.fromtimestamp(0)
        monitor_files.append(sd + " | " + file + (" | ") + str(last_modified_date) + "\n")

print("\n".join(monitor_files))   # Your code after repetitions is OK