package sftp import ( "b612.me/starssh" "os" "path" "path/filepath" ) func TransferFile(s *starssh.StarSSH, local, remote string, isPull, fullname bool) error { if !fullname && !isPull { s.ShellOne("mkdir -p " + remote) remote = remote + "/" + filepath.Base(local) } if !fullname && isPull { os.MkdirAll(local, 0755) local = filepath.Join(local, path.Base(remote)) } if fullname && isPull { os.MkdirAll(filepath.Dir(local), 0755) } if fullname && !isPull { os.MkdirAll(path.Dir(remote), 0755) } return nil }