I would like to query R for the current (or last used) filename for a graphics device. Eg after png(filename="plot%02d.png") I would like something like the output of dev.cur() but with the %02d expanded to the current name. Can anyone point me at where I can find this please?