On our jenkins server we have workspace directories whose Jobs no longer exist. This takes up precious disk space.
How can I find out which directories are being used by existing Jobs from the others?
The only way I know it to manually look at the Job name. This is impossible to be done for all directories because we have hundreds of them.
in Manage Jenkins -> Configure System,
you can see your Home Directory of your jenkins server, say $JENKINS_HOME
ssh in to your jenkins server,
du -s $JENKINS_HOME/workspace/* | sort -nrk 1
and you should have a list of most disk consuming projects, in decending order.
get a document describing your online jobs from jenkins REST service:
http://your.ci-server.com/api/json?tree=jobs[name]
your.ci-server.com
would be your jenkins server name.
you will get somthing like
{"jobs":[{"name":"a"},{"name":"b"}]}
All you have to do now is to compare these two lists to find out the wanted jobs.