Can anyone help me how to pick all the files(many files) of some particular extention(.csv) and transferring it to remote server using Jsch channel.

Please help.


help you how ?
by writing the code ? no. we're not coders-for-hire.
what have you tried so far ?

Here is the code i tried

Inline Code Example Here

        File folder = new File("Pathofthefolder");

            JSch jsch = new JSch();
            session = jsch.getSession(sftpUser, sftpHost, sftpPort);
            java.util.Properties config = new java.util.Properties();
            config.put("StrictHostKeyChecking", "no");
            for (File file : listOfFiles) {
                if (file.isFile()) {
                      InputStream inputStream = new FileInputStream(file);
                       File f = new File(file.getName());
                        channelSftp.put(inputStream, pathOfRemoteserver+f.getName());

and what is the point you are having trouble with ?

Added this below line and it is working fine:-

                channel = session.openChannel("sftp");
                channelSftp = (ChannelSftp) channel;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.