delete in JS now differentiates between files and folders