gdal vsi move

Added in version 3.11.

Move/rename a file/directory located on GDAL Virtual System Interface (VSI)

Synopsis

Usage: gdal vsi move [OPTIONS] <SOURCE> <DESTINATION>

Move/rename a file/directory located on GDAL Virtual System Interface (VSI).

Positional arguments:
  --source <SOURCE>            Source file or directory name [required]
  --destination <DESTINATION>  Destination file or directory name [required]

Common Options:
  -h, --help                   Display help message and exit
  --json-usage                 Display usage as JSON document and exit
  --config <KEY>=<VALUE>       Configuration option [may be repeated]
  --progress                   Display progress bar

Description

gdal vsi move move files and directories located on GDAL Virtual File Systems (compressed, network hosted, etc...): /vsimem, /vsizip, /vsitar, /vsicurl, ....

If the destination path is an existing directory, the file will be moved to it.

It can move files and directories between different virtual file systems, but this will involve copying and deletion.

Note that for cloud object storage, moving/renaming a directory may involve renaming all files it contains recursively, and is thus not an atomic operation (and could be slow and expensive on directories with many files!)

This is implemented by VSIMove().

This is an analog of the UNIX mv command, and gdal vsi mv is an alias for gdal vsi move.

Examples

Example 1: Rename a file within the same virtual file system

$ gdal vsi move /vsis3/bucket/my.tif /vsis3/bucket/new_name.tif

Example 2: Move a file into another directory within the same virtual file system

$ gdal vsi move /vsis3/bucket/my.tif /vsis3/bucket/existing_subdir

Example 3: Move a directory between two different virtual file systems

$ gdal vsi move /vsis3/bucket/my_directory /vsigs/bucket/