Normalizing a path removes redundant pieces such as parent-directory markers.

Path Normalize

PathNormalize.java
import java.nio.file.Path;

public class PathNormalize {
    public static void main(String[] args) {
        int draft = ;
        Path raw = Path.of("notes", "drafts", "..", "day" + draft + ".txt");
        Path clean = raw.normalize();

        System.out.println("raw=" + raw);
        System.out.println("clean=" + clean);
    }
}
import java.nio.file.Path;

public class PathNormalize {
    public static void main(String[] args) {
        int draft = ;
        Path raw = Path.of("notes", "drafts", "..", "day" + draft + ".txt");
        Path clean = raw.normalize();

        System.out.println("raw=" + raw);
        System.out.println("clean=" + clean);
    }
}
import java.nio.file.Path;

public class PathNormalize {
    public static void main(String[] args) {
        int draft = ;
        Path raw = Path.of("notes", "drafts", "..", "day" + draft + ".txt");
        Path clean = raw.normalize();

        System.out.println("raw=" + raw);
        System.out.println("clean=" + clean);
    }
}
raw path A raw path can contain navigation pieces such as `..` before it is simplified.
normalized path A normalized path has those redundant navigation pieces collapsed when possible.