summaryrefslogtreecommitdiffstats
path: root/.local/bin/flacdir
blob: c070c15d0e72dc1be90d95d48070a307f12ab112 (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/bin/env 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__