How to form FTP URL using absolute path in Windows

ftpurl

I need to write a file to a FTP server hosted in Windows operating system using absolute path. The path in which I need to write is C:\Test\Batch_File\ . When I use relative path, I am able to write the files successfully into the folder. I tried a lot of ways to form the FTP URL with absolute path but was prompted with error message.I am trying to drop files into the FTP server using iBM Datapower appliance.

Best Answer

It's up to the FTP server to map local (physical) paths to FTP paths.

Without knowing, what FTP server you are using and its configuration, we cannot give you an answer.

Typically an FTP server has an "FTP root" with a physical path being say C:\Test, and maps that to an external FTP path root (i.e. /, assuming the FTP server uses a common *nix path style).

In that case the physical path C:\Test\Batch_File would map to the FTP path /Batch_File and consequently to an URL like ftp://ftp.example.com/Batch_File. But again, that depends on configuration. As you know the physical path, I assume it's your server, so you should know its configuration.

Anyway, just login to the server with some GUI FTP client and see, what path syntax it shows.

For example in WinSCP FTP client, you see the path syntax on a top of the remote path panel:

enter image description here

Actually the WinSCP can even generate the URL of a selected folder or file for you. Just select the file or folder, and go to Files > Files Names > Generate URL:

enter image description here

(I'm the author of WinSCP)


Also note that chances are the file is outside of the FTP root, hence not accessible with the FTP at all. You cannot circumvent the FTP root by using some magical "absolute path", if that's, what your question is actually about.