Skip to main content

Module file

Module file 

Source
Expand description

Raw file operations.

This module provides low-level file copying using raw disk reads, which can bypass some filesystem-level filters.

§Permissions

Raw reads typically require elevated privileges (administrator). Without sufficient privileges, operations usually fail with crate::Error::FileOperation.

§Path Requirements

Source paths must be absolute Windows drive paths (for example C:\\path\\file.txt). Paths without a drive prefix are rejected as invalid parameters.

§Examples

use windows_erg::file;

file::raw_copy(
    r"C:\\Windows\\System32\\drivers\\etc\\hosts",
    r"C:\\Temp\\hosts.copy"
)?;
use windows_erg::file::RawFile;

let mut raw = RawFile::builder()
    .path(r"C:\\Windows\\System32\\drivers\\etc\\hosts")
    .clusters_per_read(8)
    .open()?;

raw.copy_to(r"C:\\Temp\\hosts.builder.copy")?;

Structs§

RawFile
Low-level reader for file content through raw disk cluster reads.
RawFileBuilder
Builder for opening RawFile with custom tuning parameters.

Functions§

apply_permissions
Apply a permission edit plan to a file target.
builder
Create a raw file builder.
raw_copy
Copy a file using raw disk reads.
read_security_descriptor
Read a file security descriptor.
write_security_descriptor
Write a file security descriptor.