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§
- File
Time - 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.