Results for “File operations & archives”
Small, practical examples. Search by task or narrow things down below.
Count set bits in an unsigned integer
C: Clearing the lowest set bit on each iteration counts only one iteration per set bit.
C✓ Tested
Count the elements in an array
Bash Scripts: The array length form counts assigned elements, not characters in the first value.
Bash Scripts✓ Tested
Create a nested directory tree
Create a nested directory tree in a complete Rust program using the standard library.
Rust✓ Tested
Create nested directories
Create nested directories using a complete Go program with explicit sample inputs.
Go✓ Tested
Delete rows selected by a related table
SQL: A correlated EXISTS limits the delete to explicitly listed records.
SQL✓ Tested
Delete rows selected by a related table
SQL Server: A correlated EXISTS limits the delete to explicitly listed records.
SQL Server✓ Tested
Delete rows selected by a related table
Postgres: A correlated EXISTS limits the delete to explicitly listed records.
Postgres✓ Tested
Delete rows selected by a related table
SQLite: A correlated EXISTS limits the delete to explicitly listed records.
SQLite✓ Tested
Detect an invalid Date object
JavaScript: An invalid Date has a NaN time value.
JavaScript✓ Tested
Detect an invalid Date object
TypeScript: An invalid Date has a NaN time value.
TypeScript✓ Tested
Exclude a directory from a recursive search
Linux Commands: Use prune to avoid descending into generated dependencies.
Linux Commands✓ Tested
Extract a parent directory from a path
Linux Commands: Use dirname without needing the path to exist.
Linux Commands✓ Tested