summaryrefslogtreecommitdiffstats
path: root/.local/bin/flacdir
blob: 625e72e4b9b10b48cd7aa8d46c6f867e6af340bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/local/bin/perl

use warnings;
use strict;

use constant FLAC_PATH	=> '/usr/local/bin/flac';

sub main
{
	opendir(DIR, '.') or die "Cannot open directory: $!";
	# my @files = readdir(DIR);
	my @files = grep(/\.wav$/, readdir(DIR));
	closedir(DIR);
	foreach (@files) {
		if (
			system(
				FLAC_PATH,
				'--warnings-as-errors',
				'--compression-level-0',
				'--verify',
				$_
				) != 0
			) {
			exit 1;
		}
		else {
			unlink($_);
		}
	}
	return;
}

main();

__END__