FIND YOUR NEXT FEW LINES

Results for “Files & permissions”

Small, practical examples. Search by task or narrow things down below.

380 snippets foundClear filters
Docker / ComposeDockerfile patterns

Set copied files’ numeric ownership

Docker / Compose: COPY --chown sets ownership while adding the file.

Docker / Compose✓ Tested
GitInspecting the working tree

Test whether tracked working files changed

Git: A quiet diff returns status one for differences, so handle it in a conditional.

Git✓ Tested
JavaFile operations & binary data

Visit files recursively

Java: Close the stream returned by Files.walk and sort relative paths for stable output.

Java✓ Tested
RustFiles & paths

Append to a file without truncating it

Append to a file without truncating it in a complete Rust program using the standard library.

Rust✓ Tested
C++Filesystem operations

Calculate a lexical relative path

C++: lexically_relative compares path components without requiring the paths to exist.

C++✓ Tested
RustFiles & paths

Change a path’s extension

Change a path’s extension in a complete Rust program using the standard library.

Rust✓ Tested
RustFiles & paths

Copy a file and inspect the copied byte count

Copy a file and inspect the copied byte count in a complete Rust program using the standard library.

Rust✓ Tested
C++Filesystem operations

Copy a file without replacing an existing destination

C++: The default copy_file policy refuses to overwrite an existing destination.

C++✓ Tested
GoFiles & paths

Copy a stream and count its bytes

Copy a stream and count its bytes using a complete Go program with explicit sample inputs.

Go✓ Tested
RustFiles & paths

Create a file without replacing existing data

Create a file without replacing existing data in a complete Rust program using the standard library.

Rust✓ Tested
RustFiles & paths

Create a nested directory tree

Create a nested directory tree in a complete Rust program using the standard library.

Rust✓ Tested
GoFiles & paths

Create and clean up a temporary file

Create and clean up a temporary file using a complete Go program with explicit sample inputs.

Go✓ Tested