id	summary	reporter	owner	description	type	status	priority	milestone	component	resolution	keywords	cc	remaining_time	sprint	drp_resources	o_links	i_links
5397	Delete tmp files on hudson	jamoore		"In the INSIGHT-trunk job (and probably others) older builds that have no archive files can still be 8+ MB due to tmp files leftover from the ""Tasks"" and ""Warnings"" plugins:

 * http://stackoverflow.com/questions/2500867/on-a-hudson-master-node-what-are-the-tmp-files-created-in-the-workspace-files-f

A workaround Groovy script is provided at https://wiki.jenkins-ci.org/display/JENKINS/Delete+.tmp+files+left+in+workspace-files:
{{{
import hudson.model.*

def counter = 0

// Create a ref for closure
def delClos

// Define closure
delClos = {
	it.eachDir( delClos );
	if(it.getName().contains(""workspace-files"")) {
		it.eachFile {
			if(it.getName().endsWith("".tmp"") ){
				println ""Deleting file ${it.canonicalPath}"";
				it.delete()
				counter++;
			}
		}
	}
}

// Apply closure
for(item in Hudson.instance.items) {
	println ""Applying on "" + item.rootDir
	delClos( item.rootDir )
}
println counter + "" files deleted""
}}}
"	task	new	minor	Unscheduled	General								
