partial mkfile implementation