Example usage for org.springframework.integration.sftp.session SftpSession rename

List of usage examples for org.springframework.integration.sftp.session SftpSession rename

Introduction

In this page you can find the example usage for org.springframework.integration.sftp.session SftpSession rename.

Prototype

@Override
    public void rename(String pathFrom, String pathTo) throws IOException 

Source Link

Usage

From source file:com.st.si.Main.java

private static void rename(SftpSession session, String dir) throws IOException {
    for (ChannelSftp.LsEntry entry : session.list(dir)) {
        if (!entry.getFilename().contains(".xml"))
            continue;
        System.out.println(entry.getFilename());
        String from = String.format("%s/%s", dir, entry.getFilename());
        String to = String.format("%s.done", from);
        session.rename(from, to);

    }/*from  w  w w  . j  a  va 2  s.c o m*/
}