Skip to content

truncate and cp: sparse could be supported on Windows #12186

@janko-jj

Description

@janko-jj

Trying coreutils.exe cp --sparse=always filea fileb results in cp: --sparse is only supported on linux. However Windows supports sparse files:

DeviceIoControl( h, FSCTL_SET_SPARSE, 0, 0, 0, 0, 0, 0 ); is used to set the sparse flag. To skip over the parts that shouldn't be allocated the fseek is used just like on Linux or Mac, and the file is truncated with SetFilePointerEx and SetEndOfFile.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions