I am not able to transfer files to ans from Linux machine to Windows machine as its not recognizing Windows file path. Plz help me out.

Dani AI

Generated

Short diagnosis and what likely went wrong: an FTP server on Windows exposes a virtual filesystem to clients — it does not accept raw Windows drive-letter paths. That makes a client-side path containing a drive letter fail with a "file not found / permission" style reply (550). The OP ran the FTP client from Linux () so the correct remote path must be whatever the Windows FTP server presents as its root. Browsing the remote namespace from the client is the first step.

Quick troubleshooting checklist:

  • Connect with the FTP client and use directory commands (pwd, ls, cd) to discover the server's root and where the files actually live.
  • Check the Windows FTP server configuration: which local folder is mapped to the FTP root, and does the FTP service account have read permission on the target file.
  • Try passive mode if network/NAT/firewall is involved (active mode requires the server to open a connection back to the client).
  • Test visually with a GUI FTP client (FileZilla was suggested by ) to reveal the server-side view and valid paths.
  • If plain FTP will be used across untrusted networks, plan for a secure alternative (SFTP/FTPS) because FTP sends credentials in clear text.

Programmatic Java option (Apache Commons Net FTPClient, passive mode + binary transfer):

FTPClient ftp = new FTPClient();
ftp.connect(host, port);
ftp.login(user, pass);
ftp.enterLocalPassiveMode();
ftp.setFileType(FTP.BINARY_FILE_TYPE);
try (OutputStream out = new FileOutputStream(localPath)) {
    boolean ok = ftp.retrieveFile(remotePathRelativeToServerRoot, out);
}
ftp.logout();
ftp.disconnect();

For a more robust production approach, prefer SFTP (JSch or SSH libraries) or mount the Windows share over SMB (jcifs-ng) so Java can use normal file I/O. The forum hints from about which side the client runs are important: the client view determines which paths work.

Recommended Answers

All 5 Replies

I'm giving this command to download file from Windows to Linux :

ftp> get c:/vikram/abc.txt /home/xyz.txt

And m getting error as :

local: /home/xyz.txt remote: c:/vikram/abc.txt
200 PORT command successful.
550 c:/vikram/abc.txt: The system cannot find the file specified.

Where I'm lacking !!!

I would try FileZilla from the Windows side. Being a GUI, you will see exactly where the files are and the path will become obvious.

I'm trying to do this programatically through java code. Being application deployed at Linux would it be possible to download files from Windows to Linux using Java codes ?

Are you running the ftp client on Windows or Linux?

Yes, m running FTP client on Linux machine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.