22 lines
722 B
Python
22 lines
722 B
Python
import os
|
|
import re
|
|
|
|
def extract_member_id(directory):
|
|
# Regex pattern to find "member<ID>"
|
|
pattern = re.compile(r'member(\d+)\.pdf', re.IGNORECASE)
|
|
|
|
# Loop through all files in the directory
|
|
for filename in os.listdir(directory):
|
|
if filename.endswith(".pdf"):
|
|
match = pattern.search(filename)
|
|
if match:
|
|
member_id = match.group(1)
|
|
print(f"File: {filename} -> Member ID: {member_id}")
|
|
|
|
if __name__ == "__main__":
|
|
directory = "/mnt/Data/dropbox/SUST/Zahlscheine 2025" # Change to your directory path
|
|
if os.path.exists(directory):
|
|
extract_member_id(directory)
|
|
else:
|
|
print(f"Directory '{directory}' does not exist.")
|