I wanna loop through jpg files, using find
to locate them.
The result is the full path name including ./
in front. I want to remove the replace ./
with ./newsubdir/
so I can use that as the output file name in a process, creating a modified copy of the original in newsubdir using the same folder structure.
This is what I tried.
#!/bin/bash
find . -type f -name '*jpg'
for file do
echo ${file:1}
done
However the substring extraction didn't seem to work at all. Is there a reason for that or a different way to do this. Very new to Bash.
I was going for something like this as a end result. Trying to square a bunch of pictures but keep the folder structure.
#!/bin/bash
find . -type f -name '*jpg'
for file do
convert '$file[2048x2048]' -gravity center -extent 2048x2048 "./newsubdir${file:1}"
done