perl script - cleanup demos

Post Reply
stealth
Posts: 140
Joined: Fri Dec 09, 2011 6:02 pm

perl script - cleanup demos

Post by stealth »

This script cleans up your AP demos and leaves you with the demos of your fastest times. It only removes .dm_84 files that contain the string [AP] followed by some numbers (the time).
It can probably be easily adapted to work for VQ3 and VET too, but I didn't have any of those demos to test it.

Make a file in the etrun mod folder "xxx.pl" copy paste code and run. (You obviously need perl for it to work)

Code: Select all

#!/usr/bin/perl

opendir(DIR, "demos");
@FILES = readdir(DIR);
closedir(DIR);

@AP = grep (/\[AP\]_[0-9]*-[0-9]*-[0-9]*.dm_84$/,@FILES);
@AP = sort (@AP);

$map2 = "";
foreach $rec (@AP) {
	@line = split (/\_/, $rec);
	$map1 = join ("_", @line[0..$#line-2]);
	
	if ($map1 eq $map2) {
		unlink "demos/$rec" or die "$!";
	}
	$map2 = $map1;
}
F3mm3
Posts: 37
Joined: Sun Dec 04, 2011 4:50 pm

Re: perl script - cleanup demos

Post by F3mm3 »

So useful!
thanks a lot :)
Post Reply