October 19, 2024

Move image files in directories where exist in the current directory to current directory

find . -mindepth 1 -maxdepth 1 -type d | while read dir; do
find “$dir” f \( -iname “.jpg” -o -iname “.png”\) – exec me {} . \;
done

Remove directories where exist in current directory

find . -mindepth 1 -maxdepth 1 -type d -exec rm -r {} +