I wrote a script to go into that workspace and delete jobs that are more than 8 days.
The script is mean to go in to the sub-directories (folder inside folder and inside it jobs) and delete anything more than 8 days
It delete some jobs in some directories and leave some without deleting.
Error shows: cannot delete, directory is not empty
!/bin/bash
directory="/home/jenkins/workspace/"
cd $directory && find . -mtime +8 -delete
echo $directory deleted
Your input is highly welcome Thanks