I want to make a shell script that downloads all files that area named [0-9][0-9].png;
e.g: 00.png 01.png 33.png 91.png etc
files = ???????
for file in files
do
curl ftp://server/${file}
done
What should I put at files = ???
I want to make a shell script that downloads all files that area named [0-9][0-9].png;
e.g: 00.png 01.png 33.png 91.png etc
files = ???????
for file in files
do
curl ftp://server/${file}
done
What should I put at files = ???
I'd be highly surprised if the
ftp://server/file
protocol permits wildcards. I suspect you'll have to fetch a list of the available files and iterate over the ones with 2 digits.However if you want to generate the numbers 00 to 99 in bash:
Use Bash's filename expansion (using
*
,?
and[]
):This, unlike
{0..9}{0..9}.png
, only expands to existing filenames. So you could do:Or, directly:
seq
prints a sequence of numbers.-w
equalizes width by padding with leading zeroes.