MCPcopy Create free account
hub / github.com/VirtualHotBar/NetMount / copyDir

Function copyDir

src/controller/storage/storage.ts:414–442  ·  view source on GitHub ↗
(
  storageName: string,
  path: string,
  destStoragename: string,
  destPath: string
)

Source from the content-addressed store, hash-verified

412
413//copyDir
414async function copyDir(
415 storageName: string,
416 path: string,
417 destStoragename: string,
418 destPath: string
419) {
420 // 参数验证
421 if (!storageName || !destStoragename) {
422 throw new Error('Source or destination storage name is empty')
423 }
424 if (!path) {
425 throw new Error('Source path is empty')
426 }
427
428 const srcFs = convertStoragePath(storageName, path, true)
429 const dstFs = convertStoragePath(destStoragename, destPath, true) + getFileName(path)
430
431 if (!srcFs || !dstFs) {
432 throw new Error('Invalid source or destination path')
433 }
434
435 const success = await rclone_api_exec_async('/sync/copy', {
436 srcFs,
437 dstFs,
438 })
439 if (!success) {
440 throw new Error(`Copy directory failed: ${srcFs} -> ${dstFs}`)
441 }
442}
443
444async function moveDir(
445 storageName: string,

Callers 2

ExplorerItemFunction · 0.90
executeTaskFunction · 0.90

Calls 3

rclone_api_exec_asyncFunction · 0.90
convertStoragePathFunction · 0.85
getFileNameFunction · 0.85

Tested by

no test coverage detected