Add rm_documents() function; Change rm() to delete proper recursively.