FIND YOUR NEXT FEW LINES

Results for “File operations & paths”

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

946 snippets foundClear filters
PythonFile operations & archives

Extract filename components

Python: Use pathlib properties to separate a directory, filename stem, and suffix.

Python✓ Tested
C++Filesystem operations

Handle a failed file open through stream state

C++: An unopened input stream is not an empty successful file read.

C++✓ Tested
PythonFile operations & archives

Hash a file without reading it all at once

Python: Feed fixed-size binary chunks into SHA-256 for files larger than memory.

Python✓ Tested
RustFiles & paths

Inspect a path’s filename and extension

Inspect a path’s filename and extension in a complete Rust program using the standard library.

Rust✓ Tested
GitGetting Started

List paths saved in the latest commit

Git: List paths saved in the latest commit inside the disposable repository created by the input setup.

Git✓ Tested
JavaFile operations & binary data

Move a file to a new name

Java: Files.move changes the path and returns the destination Path.

Java✓ Tested
C++Filesystem operations

Normalize a path without touching the filesystem

C++: lexically_normal removes redundant dot components using path syntax alone.

C++✓ Tested
JavaFile operations & binary data

Process a text file one line at a time

Java: Use a buffered reader to avoid loading a large file into memory.

Java✓ Tested
JavaFile operations & binary data

Read a file length in bytes

Java: Files.size inspects metadata without loading the file into a Java string.

Java✓ Tested
PythonFile operations & archives

Read a file size in bytes

Python: Use stat().st_size to read the logical byte length without loading the file.

Python✓ Tested
RustFiles & paths

Read buffered lines from a file

Read buffered lines from a file in a complete Rust program using the standard library.

Rust✓ Tested
RustFiles & paths

Read file metadata without reading its contents

Read file metadata without reading its contents in a complete Rust program using the standard library.

Rust✓ Tested