Script to remove the most-recent Cache/ additions

Thomas Otto 3.1415926535897932384626433832 at
Sun Jun 19 22:30:38 EDT 2005

Hello List, one more terrible script I want to share :)

I am using another script[1] to move the cache content to a more
permanent localation and set PurgeCacheDays=1000 UT2004.ini.

Yet sometimes servers with very vain admins make you download megabytes
of sound, skin or logo addons (just now a 50 MB soundpack) or maybe the
custom map was too bad to be kept.

To remove the most recently added Cache/ files it makes a copy of the
cache.ini before each start and when I want to remove files it lists
them after their timestamp 'ls -lt' and then deletes everything added
since the last copy of the cache.ini, named "mark-<date here>".

For this the following has to be run everytime before you start ut,
i.e. add it to the /usr/local/bin/ut2004 shellscript.

---  >% ---

cp $cache/cache.ini $cache/mark-`date +%F_%H.%M.%S`; touch $_

[ `ls $cache/mark-* | wc -l` -ge $i ] && ((j=`ls $cache/mark-* | nl | \
tail -$i | head -1 | cut -f1`-1)) && rm -f `ls $cache/mark-* | head -$j`
--- >% ---

Then running the following script will remove the files added to the
cache in the most recent ut2004 game:


I believe it is even possible to run this script while ut2004 is running
(switch to a console) since the cache.ini file is updated instantly, yet
files downloaded after this cleanup-during-a-game can't be distinguished
from the ones added in the previous gamesession, so don't run it again
until you have exited and started ut again.


[1]: <*/uncacheut2004> - cf. 4
threads below this one.

More information about the ut2004 mailing list