#!/bin/bash TARGET_DIR="{{ working_folder }}/small_thumbs" cd "$TARGET_DIR" || exit # Find all files, sort them by modification time (oldest first), and delete all but the 50 most recent ls -t | tail -n +51 | while read -r file; do if [ -f "$file" ]; then # echo "Deleting file: $file" rm "$file" fi done