save basename along with filename and only replace .rrd for it if it's at the end...
drwxr-xr-x - include
drwxr-xr-x - testbed