updated the code to support any command, no deletes of folders too