Added check to see if the file can be deleted or not