Undefined index error in trying to duplicate file
It's because of #2 here: https://docs.craftcms.com/v3/routing.html#dynamic-routes

index.html matches a route (likely you've got a Single section defined in Settings setup to load the index.html template).  Because of that, Craft will prepopulate the entry variable for that route in the template.

There currently isn't a route that matches preview/index.html, so Craft doesn't prepopulate the entry variable and you get the error you're seeing.