Back to lessons

Hosting Operations

Find Empty Files in a Backup

You need to spot empty files inside a backup tree.

Command

find backup -type f -size 0 -print

What changed

Nothing changes. The command prints zero-byte regular files.

Danger

safe

When to use it

Use after backup jobs, exports, or uploads where empty files may indicate failed writes.

When not to use it

Do not assume every empty file is bad; lock files and placeholders can be intentional.

Undo or recovery

No undo needed because this command is read-only.

Expected output

Paths to empty files in the backup directory.

demo script

Disposable terminal steps

  1. find backup -type f -printf '%s %p\n' | sort -n
  2. find backup -type f -size 0 -print

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ find backup -type f -printf '%s %p\n' | sort -n
0 backup/.snapshot
0 backup/tmp/empty.cache
13 backup/old-report.csv
26 backup/content/index.md
39 backup/app/config.yml
::exit-code::0
$ find backup -type f -size 0 -print
backup/tmp/empty.cache
backup/.snapshot
::exit-code::0

YouTube Short

Find zero-byte backup files.

Search backups for zero-byte files after exports or uploads, then decide whether each one is expected.

LinkedIn hook

Zero-byte files can be normal, or they can be failed writes.

Question: Do you flag zero-byte files in backup reports?

experiments

A/B tests to run

Metric: completion_rate

A: Zero bytes can matter.

B: Find failed writes fast.