Skip to content

Commit 387be67

Browse files
committed
Add GIF search script and diagram
Add a Python utility script that recursively searches for .gif files (case-insensitive) in the script's directory using pathlib. Also adds a diagram file.
1 parent 91decd3 commit 387be67

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

diagram.png

461 KB
Loading

search-gifs.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from pathlib import Path
2+
3+
# 1. Automatically get the directory where this script file is located
4+
folder = Path(__file__).parent.resolve()
5+
6+
print(f"Searching for .gif files in: {folder}\n")
7+
8+
# 2. Find all .gif files (case-insensitive search for both .gif and .GIF)
9+
# rglob stands for "recursive glob", which searches all sub-folders automatically.
10+
gif_files = list(folder.rglob("*.[gG][iI][fF]"))
11+
12+
# 3. Display the results
13+
if gif_files:
14+
print(f"Found {len(gif_files)} .gif image(s):")
15+
for file in gif_files:
16+
print(file)
17+
else:
18+
print("No .gif files found.")

0 commit comments

Comments
 (0)