Delete Mode
Safely synchronize deletions with the HostnExtra Sync delete option.
Delete Mode
The --delete option removes files from the remote synchronization scope when those files no longer exist in the source.
Because this operation can remove data, use it deliberately.
Basic Usage
hostnextra sync push ./build \
--to web-prod-01:/var/www \
--deleteIf a file exists in /var/www but no longer exists in ./build, it can be removed from the remote synchronization scope.
Synchronization Scope
Deletion is limited to the directory being synchronized.
Files and directories outside that synchronization scope are not candidates for deletion.
For example:
hostnextra sync push ./build \
--to web-prod-01:/var/www \
--deleteThe deletion scope is:
/var/wwwIt does not apply to unrelated directories elsewhere on the server.
Directory Only
--delete can only be used when synchronizing a directory.
It is intentionally rejected for individual files.
For example:
hostnextra sync push ./file.txt \
--to web-prod-01:/var/www \
--deleteThis prevents ambiguous file-level deletion behavior.
Confirmation
HostnExtra Sync requires explicit confirmation before performing a non-dry-run delete operation.
Use a Dry Run First
Before using --delete on an important directory, perform a dry run:
hostnextra sync push ./build \
--to web-prod-01:/var/www \
--delete \
--dry-runReview the planned changes before running the synchronization without --dry-run.
Recommended Workflow
For important deployments, use:
hostnextra sync push ./build \
--to web-prod-01:/var/www \
--delete \
--dry-runAfter reviewing the result:
hostnextra sync push ./build \
--to web-prod-01:/var/www \
--delete