MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / Copy

Method Copy

agent/utils/files/file_op.go:629–650  ·  view source on GitHub ↗
(src, dst string)

Source from the content-addressed store, hash-verified

627}
628
629func (f FileOp) Copy(src, dst string) error {
630 if src = path.Clean("/" + src); src == "" {
631 return os.ErrNotExist
632 }
633 if dst = path.Clean("/" + dst); dst == "" {
634 return os.ErrNotExist
635 }
636 if src == "/" || dst == "/" {
637 return os.ErrInvalid
638 }
639 if dst == src {
640 return os.ErrInvalid
641 }
642 info, err := f.Fs.Stat(src)
643 if err != nil {
644 return err
645 }
646 if info.IsDir() {
647 return f.CopyDir(src, dst)
648 }
649 return f.CopyFile(src, dst)
650}
651
652func (f FileOp) CopyAndReName(src, dst, name string, cover bool) error {
653 if src = path.Clean("/" + src); src == "" {

Callers 15

UploadForRecoverMethod · 0.95
copyDataFunction · 0.95
UpdateConfigFileMethod · 0.95
RegisterImagesFunction · 0.80
CopyFileFunction · 0.80
DownloadFileFunction · 0.80
GetFileMD5Function · 0.80
PageLoginLogMethod · 0.80
PageOperationLogMethod · 0.80
CreateMethod · 0.80
UpdateMethod · 0.80

Calls 5

CopyDirMethod · 0.95
CopyFileMethod · 0.95
IsDirMethod · 0.80
CleanMethod · 0.65
StatMethod · 0.45

Tested by

no test coverage detected