Results for “File positioning & lifecycle”
Small, practical examples. Search by task or narrow things down below.
Discard an unstaged edit to one tracked file
Git: Restore copies the index version back into the selected working file.
Git✓ Tested
Distinguish a file from a directory
PowerShell: Test-Path can constrain the kind of item that is accepted.
PowerShell✓ Tested
Encode and decode a file with Base64
Linux Commands: Use GNU base64 for text transport of bytes and --decode for the reverse operation.
Linux Commands✓ Tested
Enumerate matching files recursively
C#: Sort relative filenames when reproducible traversal output is required.
C#✓ Tested
Exclude files from the build context
Docker / Compose: A dockerignore file prevents selected local files from being copied.
Docker / Compose✓ Tested
Exclude generated files from an archive
Linux Commands: Place exclude options before the input paths to control archive membership.
Linux Commands✓ Tested
Explain which ignore rule matches a file
Git: check-ignore -v reports the source file, line, pattern, and matched path.
Git✓ Tested
Export a container filesystem into a new image
Docker / Compose: export contains filesystem data; import creates a new image from it.
Docker / Compose✓ Tested
Export committed files without the Git metadata directory
Git: Git archive creates a snapshot of tracked committed files only.
Git✓ Tested
Extract a filename from a path
Linux Commands: Use basename with an explicit suffix when removing a known extension.
Linux Commands✓ Tested
Extract filename components
Python: Use pathlib properties to separate a directory, filename stem, and suffix.
Python✓ Tested
Find empty regular files
Linux Commands: Use the empty predicate with a file type constraint.
Linux Commands✓ Tested