Possibly. But then in Python that would just be:
Seriously, if you are starting, use Python. Simpler and more powerful: in script-fu, your limits are the tiny interpreter that's built-in. In Python, you limits are 1) a vastly more powerful interpreter and its standard libraries and 2) several thousands additional libraries. In addition Python is a very popular languages, many people can help, and you will find other uses for it.
If you want examples see there. For what you are doing, my ofn-tiles script may contain some useful sample code.
Code:
for file in sorted(glob.glob('*.png')):
# do you stuff here
Seriously, if you are starting, use Python. Simpler and more powerful: in script-fu, your limits are the tiny interpreter that's built-in. In Python, you limits are 1) a vastly more powerful interpreter and its standard libraries and 2) several thousands additional libraries. In addition Python is a very popular languages, many people can help, and you will find other uses for it.
If you want examples see there. For what you are doing, my ofn-tiles script may contain some useful sample code.