make file functionality flexible like directory functionality