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§
- A helper structure to represent a timestamp for a file.
Functions§
- Set the last access time for a file on the filesystem.
- Set the creation time for a file on Windows, returning any error encountered.
- Set the last access, modification and creation times for a file handle.
- Set the last modification time for a file on the filesystem.
- Set the last access, modification, and creation times for a file on the filesystem.
- Set the last access, modification and creation times for a file on the filesystem. This function does not follow symlink.