Results for “File operations & archives”
Small, practical examples. Search by task or narrow things down below.
Copy a directory while preserving attributes
Linux Commands: Use cp -a for a recursive local copy that preserves links and ordinary file attributes.
Linux Commands✓ Tested
Copy a directory’s contents into an image
Docker / Compose: A directory COPY includes its children at the destination.
Docker / Compose✓ Tested
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
Copy an array independently
Bash Scripts: A new array assignment copies element values rather than creating a shared reference.
Bash Scripts✓ Tested
Copy an artifact from an earlier build stage
Docker / Compose: A named stage can produce an artifact without copying its other files.
Docker / Compose✓ Tested
Copy selected rows into another table
SQL: INSERT SELECT performs a set-based copy with an explicit destination column list.
SQL✓ Tested
Copy selected rows into another table
SQL Server: INSERT SELECT performs a set-based copy with an explicit destination column list.
SQL Server✓ Tested
Copy selected rows into another table
Postgres: INSERT SELECT performs a set-based copy with an explicit destination column list.
Postgres✓ Tested
Copy selected rows into another table
SQLite: INSERT SELECT performs a set-based copy with an explicit destination column list.
SQLite✓ Tested
Count days between UTC-midnight dates
JavaScript: A day is exactly 86400000 milliseconds for these explicitly UTC-midnight inputs.
JavaScript✓ Tested
Count days between UTC-midnight dates
TypeScript: A day is exactly 86400000 milliseconds for these explicitly UTC-midnight inputs.
TypeScript✓ Tested
Count occurrences in a sorted sequence
C++: equal_range finds the half-open interval containing values equal to the key.
C++✓ Tested