Crate filetime_creation

Source
Expand description

Timestamps for files in Rust

An enhanced version of filetime, which can set file creation time on Windows.

Internally, this crate use SetFileTime Win32 API to set the file creation time on Windows.

On other platforms, all functions will just call the corresponding filetime’s function, and ignore the file creation time.

§Installation

Add this to your Cargo.toml:

[dependencies]
filetime_creation = "0.1"

§Usage

use std::fs;
use filetime_creation::{FileTime, set_file_ctime};

let now = FileTime::now();

set_file_ctime("test.txt", now);
assert_eq!(now, FileTime::from(fs::metadata("test.txt").unwrap().created().unwrap()));

Structs§

FileTime
A helper structure to represent a timestamp for a file.

Functions§

set_file_atime
Set the last access time for a file on the filesystem.
set_file_ctime
Set the creation time for a file on Windows, returning any error encountered.
set_file_handle_times
Set the last access, modification and creation times for a file handle.
set_file_mtime
Set the last modification time for a file on the filesystem.
set_file_times
Set the last access, modification, and creation times for a file on the filesystem.
set_symlink_file_times
Set the last access, modification and creation times for a file on the filesystem. This function does not follow symlink.