Results for “Test-Path”
Small, practical examples. Search by task or narrow things down below.
Read the directory portion of a path
Linux Commands: Read the directory portion of a path using GNU/Linux commands in an empty practice directory.
Linux Commands✓ Tested
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
Restrict a diff to one chosen path
Git: Use the double dash separator to distinguish a filename from revisions or options.
Git✓ Tested
Test whether an array contains a value
PowerShell: The contains operator compares complete items rather than matching substrings.
PowerShell✓ Tested
Read commit subjects affecting one file
Git: Place the path after -- so Git limits history to the selected file.
Git✓ Tested
Stash edits to one chosen file
Git: A pathspec limits the stash to selected paths while other changes remain in the working tree.
Git✓ Tested
Accept one typed value at a time from a pipeline
PowerShell: An advanced function uses process to handle each pipeline item.
PowerShell✓ Tested
Accumulate pipeline input across begin process and end
PowerShell: Keep initialization and final output separate from per-item work.
PowerShell✓ Tested
Add a calculated property during selection
PowerShell: A calculated property can derive a value while retaining selected original properties.
PowerShell✓ Tested
Append a line
Append text to a Java file, creating it if necessary.
Java✓ Tested
Append a line to a file
Add a new line to the end of a text file without replacing its existing contents. Append mode also creates the file if it does not exist.
file✓ Tested
Append a line while keeping earlier content
PowerShell: Add-Content appends using an explicitly selected encoding.
PowerShell✓ Tested