MCPcopy Create free account
hub / github.com/apache/impala / CopyDirectory

Function CopyDirectory

be/src/kudu/util/env_util.cc:269–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269Status CopyDirectory(Env* env, const std::string& source_path, const std::string& dest_path,
270 WritableFileOptions opts) {
271 bool is_dir;
272 RETURN_NOT_OK(env->IsDirectory(source_path, &is_dir));
273
274 if (!is_dir) {
275 return Status::InvalidArgument("source is not a directory");
276 }
277
278 vector<string> children;
279 RETURN_NOT_OK(ListFilesInDir(env, source_path, &children));
280
281 RETURN_NOT_OK(env->CreateDir(dest_path));
282 for (const auto& c : children) {
283 string source = JoinPathSegments(source_path, c);
284 string dest = JoinPathSegments(dest_path, c);
285 RETURN_NOT_OK(env->IsDirectory(source, &is_dir));
286 if (is_dir) {
287 RETURN_NOT_OK(CopyDirectory(env, source, dest, opts));
288 } else {
289 RETURN_NOT_OK(CopyFile(env, source, dest, opts));
290 }
291 }
292
293 return Status::OK();
294}
295
296Status DeleteExcessFilesByPattern(Env* env, const string& pattern, int max_matches) {
297 // Negative numbers don't make sense for our interface.

Callers

nothing calls this directly

Calls 7

InvalidArgumentFunction · 0.85
ListFilesInDirFunction · 0.85
JoinPathSegmentsFunction · 0.85
CopyFileFunction · 0.85
OKFunction · 0.85
IsDirectoryMethod · 0.80
CreateDirMethod · 0.80

Tested by

no test coverage detected