@ Beta @ SuppressWarnings ( "GoodTime" ) // reading system time without TimeSource public static void touch ( File file ) throws IOException { checkNotNull ( file ) ; if ( ! file . createNewFile ( ) && ! file . setLastModified ( System . currentTimeMillis ( ) ) ) { throw new IOException ( "Unable to update modification time of " + file ) ; } }
Creates an empty file or updates the last updated timestamp on the same as the unix command of the same name .