I've been trying to copy a file from the local directory to a remote directory. The problem is I don't know how to specify the address of the destination which is another computer. Can someone please show an example of ftp URL with ip address. It would be helpful if the URL also include user name, password, port and a specific path .Thanks.
Asked
Active
Viewed 2,131 times
1 Answers
2
It's easy, read the section URI format of ftp Camel manual (http://camel.apache.org/ftp2.html).
According to Camel documentation:
URI format
ftp://[username@]hostname[:port]/directoryname[?options]
sftp://[username@]hostname[:port]/directoryname[?options]
ftps://[username@]hostname[:port]/directoryname[?options]
Just replace the hostname by remote IP.
URL also can include password :
ftp://user:password@192.168.10.20:21/dir/subdir
or you can define user and password in options:
ftp://192.168.10.20:21/dir/subdir?user=user&password=password

Alexey Yakunin
- 1,743
- 1
- 19
- 21
-
I tried this already. There doesn't seem to be any bug but the destination is simply not receiving the file. I'm trying to send it to another computer on the same network. Could you show me an example of the URL if my destination directory is E://test/inbox on the other computer. Are the user name and password the same as the credentials required for logging in to the computer? – Milan Aug 04 '17 at 11:23
-
1@Milan Do you use ftp or smb? This path ( E://test/inbox ) does not matter, because you can map this directory to a logical directory with any name. It depends on the settings of your ftp server. – Alexey Yakunin Aug 04 '17 at 11:52
-
I use ftp.And I don't know about manually setting up the ftp server.If i have to send files to another computer,is there some sort of configuration needed for the other computer – Milan Aug 07 '17 at 04:22
-
1@Milan If it is a foreign ftp server, then you need to know the directory and you have to specify it in the URL. If this is your test ftp server you can configure the directories as you need. Here is an example of the configuration directories on my server Filezilla http://prntscr.com/g5bfm4 C:\install will be root dir, all install subdirectory will be ftp subdirirectory. URL will be ftp://free:free@127.0.0.1:21/xml (xml is subdir of install dir) or just ftp://free:free@127.0.0.1:21/ for accessing to с:\install dir – Alexey Yakunin Aug 07 '17 at 08:38
-
Thank you Alexey .It helped! – Milan Aug 10 '17 at 09:08