Thanks for pointing to https://github.com/juju/utils/blob/master/fs/copy.go
I was testing Copy function that recursively copies directories. I am able
to copy first level of files and it creates directories. It fails to copy
the contents within those directories.
func Copy(src, dst string) error {...}
Error
$ triggerCopyCommand.go
lstat sd101-jvm/target/*.jar: no such file or directory ---> This is OK. As
it does not exists.
lstat sd101-python/sd101/*: no such file or directory ---> This exists in
the directory from which Copy is invoked.
lstat sd101-r/sd101/*: no such file or directory ---> This exists.
lstat sd101-shell/sd101/*: no such file or directory ---> This exists.
$ ls sd101-python/sd101/
__init__.py prepare setup.py train
$
$ ls sd101-r/sd101/
helloWorld.R
$ ls sd101-shell/sd101/
ls: sd101-shell/sd101/: No such file or directory
$
Any suggestions ?
Can this code be
replicated https://github.com/juju/utils/blob/master/fs/copy.go ? Or do you
recommend using it as a library ?
On Tuesday, January 17, 2017 at 2:12:29 AM UTC-8, rog wrote:
>
> You don't really need to use the external cp command:
> https://play.golang.org/p/F1YHzQL4UN
>
>
> On 16 January 2017 at 21:35, Deepak Jain <[email protected] <javascript:>>
> wrote:
> > util.ExecuteCommandWithOuput(exec.Command("cp", "-r", "./*.json",
> > artifact.dir))
> >
> > func ExecuteCommandWithOuput(cmd *exec.Cmd) {
> > output, err := cmd.Output()
> > if err != nil {
> > log.Print("Error executing ", cmd.Args, err)
> > }
> > fmt.Print(string(output))
> > }
> >
> >
> > Output
> >
> > 2017/01/16 13:26:35 Error executing [cp -r ./*.json myartifact] exit
> status
> > 1
> >
> >
> > Questions
> > 1. How do i get details of complete error message on failure of cp
> command ?
> > I did have err != nill and Print err
> > 2. Does exec.Command not support copy of files and recursive copy of
> > directories ?
> > 3. Any suggestions how i implement copy of files and recursive copy of
> > directories ?
> >
> > I have just started adopting Go and hence a new comer with Go.
> > Regards,
> > Deepak
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to [email protected] <javascript:>.
> > For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.