SSH Maverick : Looking for files on the remote machine -


i using maverick ssh library connect remote machine. trying find file or group of files in specific directory based on wild card : abc*.txt

i tried use sftpclient ls(string str) method, didn't work :

try{         string filename = "/tmp/mydir/abc*.txt";         sftpfile[] files = sftp.ls(filename);         if(files != null && files.length > 0)           retcode = true;      }     catch(exception ex){         system.out.println("exception : " + ex);     } 

i getting : no such file exception.

is there way find out whether file/group of files exist on remote machine?

are using api https://www.sshtools.com/j2ssh-javadocs/com/sshtools/sftp/sftpclient.html?

as javadoc states ls method takes string path directory , not sort of regular expression.

you can try programmatically listing each directory in desired path , search array of sftpfile(s) returned if need.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -