以下の内容はhttps://blog1.mammb.com/entry/2020/10/18/090000より取得しました。


Java で touch する


ファイルのタイムスタンプを変えるには Files.setLastModifiedTime() が使える。

public static void touch(final Path path) throws IOException {
    if (Files.exists(path)) {
        Files.setLastModifiedTime(path, FileTime.from(Instant.now()));
    } else {
        Files.createFile(path);
    }
}


または、File.setLastModified() も可能。

public static void touch(File file) throws IOException {
    if (!file.exists()) {
       new FileOutputStream(file).close();
    }
    file.setLastModified(System.currentTimeMillis());
}






以上の内容はhttps://blog1.mammb.com/entry/2020/10/18/090000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14