next_stash_filename = function(root)
local i = 1
while true do
local filename = root..'.'..tostring(i)
if not file_exists(Stash_directory..filename) then
return filename
end
i = i+1