We host software for one of our customers that makes heavy use of java. Unfortunately, the Java cache folder can get to be quite large. So, when you have several hundred user profiles on a terminal server, this can very quickly fill up the drive.

Can someone help me with a script that will forcefully delete the folders & all content in this folder for all users on a server:

C:\Documents and Settings\%UserName%\Application Data\Sun\Java\Deployment\cache

Thanks in advance,

0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


All you need to do is find a script which recursively walks a folder tree. Then you can add whatever action you want by editing it. There are literally thousands of examples available. Try Googling for 'VBScript +folder +recurse' or 'VBScript +folder +recursive'
Answered 11/20/2008 by: VBScab
Red Belt

Please log in to comment
Hey VBScab, if you don't know how to solve Alicia's problem, don't answer...
You think that know everything but never answer nothing just have you tried to google it?

Google how to be polite

www.google.com 'how to be polite'
Answered 02/06/2009 by: nikolofski1
Senior Yellow Belt

Please log in to comment
My friend, are you familiar with the phrase "re-inventing the wheel"? I have written more pages of code than you could shake a stick at but I see little point in reproducing code here that can be obtained in less than a minute by using tools available to everyone.

a) it's nice to know that you have gone through every one of my 2900-odd posts and come to the conclusion that all I do is point people at Google. Still enough people have been happy enough with my responses to award me points, so I figure I'm doing something right; and
b) you seem unfamiliar with the concept of 'signatures' in fora (that's the correct plural form for 'more than one forum', BTW). It's my signature that contains the helpful hint that a good proportion of questions posted here (and elsewhere) could be answered in a lot less time by the simple expedient of undertaking some basic research.
Answered 02/06/2009 by: VBScab
Red Belt

Please log in to comment
Answered 02/06/2009 by: turbokitty
Sixth Degree Black Belt

Please log in to comment

I believe something simple like:
for /d %d in ("c:\documents and settings\*") do rd /s/q "%d\Application Data\Sun\Java\Deployment\cache"

Will do what you need from a standard commandline.

If you want a little more control:
C:\> del cleanup.bat
C:\> for /d %d in ("c:\documents and settings\*") do echo >>cleanup.bat rd /s/q "%d\Application Data\Sun\Java\Deployment\cache"
then after checking the commandfile cleanup.bat (in you favority editor), execute it.
C:\> cleanup.bat

Using vbscript or powershell much more elaborate and fancy solutions can be build, but in general... Keep It Simple Stupid (KISS method) works!

You might also want to think about making a logout script for every user which will just do a: rd /s/q "%username%\Application Data\Sun\Java\Deployment\cache"
so that every time a user logout from the terminal server he/she cleansup its cache.
Answered 11/24/2009 by: wwals
Yellow Belt

  • I know this is old, but I wanted to give my input in case anyone comes across this in the future. Your "something simple" solution worked great for me! Only thing is in batch '%d' needs to be replaced with '%%d'
Please log in to comment
Answer this question or Comment on this question for clarity