I use this code in my scripts to process files inside a folder, but it only works for subfolders.
if [ -d "$1" ]; then for file in "${1%/}/"*/*(*.mkv|*.mp4|*.avi); do I know I can just remove /* to work with flat folders, but I'm looking for a more clean way to handle both flat folders ( no subfolders ) and folders with subfolders.
I have big code in the for loop so I don't want solutions that rely on find