There are a few ways to go through this - my preferred method is always developing a GIMP-Python plug-in. Script-fu uses GIMP's built-in scheme implementation, which is extremely poor in handling I/O (such as listing files in a directory) - a task which is absolutely trivial in Python.
SO, since you said you don't want to save new scripts (you could do it because you can add new plug-in and scripts directories on edit->preferences->folder options so that you don't need to write on ~/.gimp*/plugins/)
Anyway, you can open the python console under filters, and paste this snippet in the interactive prompt.
import gimpfu
def convert(filename):
img = pdb.gimp_file_load(filename, filename)
new_name = filename.rsplit(".",1)[0] + ".png"
layer = pdb.gimp_image_merge_visible_layers(img, gimpfu.CLIP_TO_IMAGE)
pdb.gimp_file_save(img, layer, new_name, new_name)
pdb.gimp_image_delete(img)
This small function will open any image, passed as a file path, flatten it, and save it as a png with the default settings, in the same directory.
Following the function, you can simply type:
from glob import glob
for filename in glob("*.xcf"):
convert(filename)
On the interactive prompt to convert all .xcf files on the current directory to .png
(If you don't have gimp-python installed, it may be a separate package on your linux distribution, just install it using your favorite tool - for those under windows, and gimp-2.6, the instructions on this page have have to be followed - it should become easier on gimp 2.8)
Another way, altogether, applies if your images are sequentially numbered in their filenames, such as myimage_001.xcf, mymage_002.xcf and so on. If they are so arranged you could install GIMP-GAP (gimp animation package) which allows one to apply any filters or actions in such an image sequence.