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
Docker / ComposeCompose service options

Read a secret from a mounted file

Docker / Compose: Compose secrets make a file available under /run/secrets.

Docker / Compose✓ Tested
JavaScriptFiles & async

Read a UTF-8 file

Read a small file as text using Node.js.

JavaScript✓ Tested
CFile positioning & lifecycle

Read bytes from a chosen file offset

C: Check fseek before reading so an unsupported or invalid seek is not ignored.

C✓ Tested
GitCommit history & revision selection

Read commit subjects affecting one file

Git: Place the path after -- so Git limits history to the selected file.

Git✓ Tested
Bash ScriptsInput streams & redirection

Read from a dedicated file descriptor

Bash Scripts: An explicitly opened descriptor keeps the script’s ordinary standard input available.

Bash Scripts✓ Tested
Bash ScriptsInput streams & redirection

Read null-delimited filenames into an array

Bash Scripts: A null delimiter preserves spaces and embedded newlines in filenames.

Bash Scripts✓ Tested
Linux CommandsArchive integrity & packaging

Read one archived file to standard output

Linux Commands: Use tar -O with an explicit member name instead of writing files to disk.

Linux Commands✓ Tested
Linux CommandsGetting Started

Read the filename portion of a path

Linux Commands: Read the filename portion of a path using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested
GitGetting Started

Recognize an untracked file

Git: Recognize an untracked file inside the disposable repository created by the input setup.

Git✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Refuse to overwrite an existing file with redirection

Bash Scripts: Noclobber makes a plain greater-than redirection fail when the target already exists.

Bash Scripts✓ Tested
Bash ScriptsVariables & text

Remove a filename extension

Keep the path while removing its final extension.

filename✓ Tested
CFile positioning & lifecycle

Remove one known scratch file

C: Check remove’s return value instead of assuming deletion succeeded.

C✓ Tested