for loop for multiple extension and do something with each file

You are not using $file anywhere. Try

for file in "$arg"/*.{jpg,jpeg,png} ; do
    echo "$file" > z.txt
done

Leave a Comment