24 lines
No EOL
414 B
Fish
Executable file
24 lines
No EOL
414 B
Fish
Executable file
#!/usr/bin/fish
|
|
|
|
if not set -q argv[1]
|
|
echo "Usage: $argv[0] /path/to/search"
|
|
exit 1
|
|
end
|
|
|
|
for jpg in (find $argv[1] -type f -name '*.jpg')
|
|
set avif (string replace -r '\.jpg$' '.avif' $jpg)
|
|
|
|
if test -f $avif
|
|
echo Skip $avif
|
|
continue
|
|
end
|
|
|
|
echo Converting $jpg to $avif
|
|
avifenc $jpg $avif
|
|
|
|
set json "$jpg.JSON"
|
|
if test -f $json
|
|
echo Renaming JSON $json to "$avif.JSON"
|
|
mv $json "$avif.JSON"
|
|
end
|
|
end |