Page 1 of 1

perl script - cleanup demos

Posted: Sat Oct 20, 2012 5:12 pm
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;
}

Re: perl script - cleanup demos

Posted: Sun Oct 21, 2012 12:49 pm
by F3mm3
So useful!
thanks a lot :)