my @files = sort glob "*.mkv"; # Segment-UID via mkvinfo auslesen my @segment_uids; foreach my $filename (@files) { my $uid = `mkvinfo --ui-language en "$filename" | grep -i '\+ Segment UID:'`; chomp $uid; $uid =~ s/.*:\s+//; push @segment_uids, $uid; } # Ueber alle Dateien iterieren und Felder setzen foreach my $idx (0..scalar(@files) - 1) { my @options; push @options, "--set 'next-uid=" . $segment_uids[$idx + 1] . "'" if ($idx + 1 < scalar(@files)); push @options, "--set 'prev-uid=" . $segment_uids[$idx - 1] . "'" if ($idx > 0); system qq|mkvpropedit "$files[$idx]" --edit info | . join(" ", @options); }