I'm using JSch to upload file via sftp.
im uploading file from windows to unix server
Upon uploading im using
ChannelSFTP.put(file)
As such:
File file = FiletoPath;
sftp.put(new FileInputStream(file), file.getName());
This However will appear as since getName() will return name of file or absolute path:
\\something\something\something\Documents$\something\something\myfilename.txt
when I try to split it will have error
String[] split = file.getName().split("\\");
sftp.put(new FileInputStream(file), split[split.length-1]);
I am out of idea. How do I solve this issue?
I have Soved it.
Basically due to
I use org.google.guava.Splitter.jar: Download it online org.google.guava.Splitter.jar
Below my snippet code: