import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.PathMatcher;

public class PolaBerkas {
    public static void main(String[] args) {
        PathMatcher teks = FileSystems.getDefault().getPathMatcher("glob:*.txt");
        PathMatcher gambar = FileSystems.getDefault().getPathMatcher("glob:*.{jpg,png,gif}");
        PathMatcher arsip = FileSystems.getDefault().getPathMatcher("glob:*202?*.zip");

        String[] nama = {
                "laporan.txt", "foto-budi.jpg", "icon.png",
                "cadangan-2025.zip", "data.csv"
        };
        for (String n : nama) {
            Path p = Path.of(n);
            System.out.printf("%-20s teks=%-5b gambar=%-5b arsip=%b%n",
                    n, teks.matches(p), gambar.matches(p), arsip.matches(p));
        }
    }
}
