I'm trying to get a per-directory total size of all the .jpg/.jpeg images in each directory that contains such images. And showing the full directory path.
I'm no bash expert but I've managed to cobble this together from various bits I've found.
for i in $(tree -dfi --noreport); do
find . \( -iname "*.jpg" -or -iname "*.jpeg" \) -type f -exec du -c {} \; $i
done
However I'm getting an error:
find: paths must precede expression
Anyone know what I've done wrong?
Or can suggest any alternatives with bash that might do what I'm looking for?
I get the same error when changing it to this:
for i in $(tree -dfi --noreport); do
find $i \( -iname "*.jpg" -or -iname "*.jpeg" \) -type f -exec du {} \; $i
done
$ithe directory where you want to search for jp[e]g images, that is, the path? If so, "[the] path[s] must precede the expression" (the bit where you put the-inames). Why do you have a.afterfindinstead of$i? – njsg Jan 9 at 16:21$iat the end... – njsg Jan 9 at 17:33