FIND YOUR NEXT FEW LINES

Results for “EXISTS”

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

31 snippets foundClear filters
Linux CommandsSearching text

Branch on whether a pattern exists

Linux Commands: Use grep -q in a conditional so an ordinary no-match result is not an unhandled failure.

Linux Commands✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Check whether a variable exists under nounset

Bash Scripts: The plus expansion distinguishes an unset variable without reading its missing value.

Bash Scripts✓ Tested
SQLJoins & subqueries

Find rows with a related record

Use EXISTS without duplicating the outer rows.

EXISTS✓ Tested
Bash ScriptsFiles & reliability

Check that a file is present and nonempty

Test file content availability before reading it.

file check✓ Tested
C#File operations & paths

Copy a file without overwriting

C#: File.Copy defaults to refusing a destination that already exists.

C#✓ Tested
JavaFile operations & binary data

Copy a file without replacing an existing destination

Java: Files.copy fails if the destination already exists unless replacement is explicitly enabled.

Java✓ Tested
PowerShellFiles & paths

Create a directory if needed

Ensure a directory exists before writing output.

New-Item✓ Tested
PythonFile operations & archives

Create a file without overwriting an existing one

Python: Use exclusive creation mode and handle FileExistsError explicitly.

Python✓ Tested
PythonFiles & paths

Create nested folders

Create a folder and any missing parent folders in one call. Running the code again is safe when the folder already exists.

directory✓ Tested
JavaFile operations & binary data

Delete a known temporary file if present

Java: deleteIfExists returns whether a file was removed and still reports other I/O errors.

Java✓ Tested
SQLBulk changes & set operations

Delete rows selected by a related table

SQL: A correlated EXISTS limits the delete to explicitly listed records.

SQL✓ Tested
SQL ServerBulk changes & set operations

Delete rows selected by a related table

SQL Server: A correlated EXISTS limits the delete to explicitly listed records.

SQL Server✓ Tested