Home How to check file Exist or not?
Reply: 0

How to check file Exist or not?

user1001
1#
user1001 Published in July 19, 2018, 9:44 am

This question already has an answer here:

  • Checking file existence on FTP server 2 answers

Here I'm trying to check whether the file exist or not.but the below code doesn't return anything and also get the error at this line

Error line : Boolean t = fileslist.Exists()

   start()
    def start(){
    def store;
    boolean success;
    def ftpClient = new FTPClient()
    ftpClient.connect(server)
    ftpClient.login(user,pass) 
     ftpClient.enterLocalPassiveMode()
     FTPFile[] fileslist = ftpClient.listFiles("/Sample.txt")
     ftpClient.setFileType(FTP.BINARY_FILE_TYPE)
     filelist.each{
          it.exists()
       }  
     ftpClient.disconnect() 

    }

Thanks

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.36449 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO