I wanted to list all the files under a directory which is on public FTP server.
I tried the following
new File("ftp://ftp.ex.yyy/a").eachFile() { file->
println file.getName()
But I get an error
URI
/sample/getStatus/index
Class
java.io.FileNotFoundException
Message
/Users/aaaaa/Documents/yyyyy/sample/ftp://ftp.ex.yyy/a
Any help is appreciated
You can’t treat an FTP site like its a local file. That’s why you are getting that exception. Your code is looking on your local file system. After a little googling I found a code snippet for you. I don’t think you’ll be able to easily do this without at least one third party library.
https://gist.github.com/1135043