Joining remote paths in Java
- by Mickael Marrache
I'm using the FTP library provided by Apache (commons-net). I want to check if a file exists on the FTP server so I use the listFiles method of FTPClient:
ftpClient.listFiles(remoteFileDir + "\\" + fileName);
The current directory is the FTP server root directory. So, the value of remoteFileDir is a path relative to this root directory.
My…