GDAL

gdalalg_vsi_copy.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: gdal "vsi copy" subcommand
5 * Author: Even Rouault <even dot rouault at spatialys.com>
6 *
7 ******************************************************************************
8 * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef GDALALG_VSI_COPY_INCLUDED
14#define GDALALG_VSI_COPY_INCLUDED
15
16#include "gdalalgorithm.h"
17
19
20/************************************************************************/
21/* GDALVSICopyAlgorithm */
22/************************************************************************/
23
24 class GDALVSICopyAlgorithm final : public GDALAlgorithm
25{
26 public:
27 static constexpr const char *NAME = "copy";
28 static constexpr const char *DESCRIPTION =
29 "Copy files located on GDAL Virtual System Interface (VSI).";
30 static constexpr const char *HELP_URL = "/programs/gdal_vsi_copy.html";
31
32 static std::vector<std::string> GetAliasesStatic()
33 {
34 return {"cp"};
35 }
36
37 GDALVSICopyAlgorithm();
38
39 private:
40 std::string m_source{};
41 std::string m_destination{};
42 bool m_recursive = false;
43 bool m_skip = false;
44
45 bool RunImpl(GDALProgressFunc, void *) override;
46
47 bool CopySingle(const std::string &src, const std::string &dst,
48 uint64_t size, GDALProgressFunc pfnProgress,
49 void *pProgressData) const;
50
51 bool CopyRecursive(const std::string &src, const std::string &dst,
52 int depth, int maxdepth, uint64_t &curAmount,
53 uint64_t totalAmount, GDALProgressFunc pfnProgress,
54 void *pProgressData) const;
55};
56
58
59#endif
GDALAlgorithm
GDAL algorithm.
Definition gdalalgorithm_cpp.h:2261