Add -f to rm command to avoid unnecessary error messages.
Return the exit code of the system() call to get rid of the warning which becomes an error.