#!/bin/bash SRC="/mnt/l/GrailHeart/opus" # Loop through all items in the current directory for item in *; do # Check if the item is a directory if [ -d "$item" ]; then if [ ! -d $SRC/$item ]; then echo "No such source folder as $SRC/$item" continue fi # Create the local destination folder if it doesn't exist mkdir -p "$item/image" # Copy only newer jpgs, quoting paths to handle spaces safely cp -uv "$SRC/$item/image/"*.jpg "$item/image/" 2>/dev/null if [ -f "$SRC/$item/*.png" ]; then ls $SRC/$item/*.png fi fi done