This works and deletes the folders but i get several error messages stating No such file or directory under "/app/Jenkins/home/jobs/test2/builds". Can you please explain why and what is a good approach to avoid such warning messages ?
I'm also curious to learn why exec would work while pipe xargs would not !!
because that is how it was designed to work with find, and it is not xargs the culprit but rm command
in other words many commands e.g. accept a - to take for input what comes from a pipe, rm does not...
but you could try (in ksh...)
rm -rf $(/usr/bin/find /app/Jenkins/home/jobs/test2/builds -type d -mtime 1)
To question one, usually I would say you had links that were deleted by the first line, or temp files at the time of the find that were no more there when it came to rm