dutchcoders / goftp

Golang FTP library with Walk support.
MIT License
278 stars 99 forks source link

"File not found" #14

Open broakenmedia opened 8 years ago

broakenmedia commented 8 years ago
 fmt.Println("Current path:", curpath)
   var innerfiles []string
       if innerfiles, err = ftp.List(""); err != nil {
          panic(err)
  }

returns: Current path: /40610 [Size=501214;Modify=20151215133602.000;Type=file; 40610_3286561_68607792_cmp.xml.gz Size=49742;Modify=20151215133602.000;Type=file; 40610_3286561_68607792_cmp_delta.xml.gz Size=49742;Modify=20151215133602.000;Type=file; 40610_3286561_68607792_cmp_deltatemplate.txt.gz Size=501214;Modify=20151215133602.000;Type=file; 40610_3286561_68607792_cmp_template.txt.gz Size=42;Modify=20151215133602.000;Type=file; 40610_category_list.txt ]

filename := strings.TrimSpace(strings.Split(innerfiles[0], ";")[3])

== 40610_3286561_68607792_cmp.xml.gz

var file *os.File
if file, err = os.Open(curpath + "/" + filename); err != nil {
    panic(err)
}

panic: open /40610/40610_3286561_68607792_cmp.xml.gz: no such file or directory

despite listing all the correct files, accessing the correct directory and the file existing, i am told it cannot open a non existent file? What's happening here?