【问题标题】:Create file on another server在另一台服务器上创建文件
【发布时间】:2011-09-19 21:30:53
【问题描述】:

如何在另一个 Windows 服务器中创建文件?服务器有一个用户名、密码、IP 地址和特定目录。

【问题讨论】:

  • 不需要在标题中添加语言名称,尽量使用标签。
  • @igor:除非您认为关键字足够重要以至于它应该显示在相关问题列表中,否则关闭为重复列表,链接,......事实上标签不能替代放置重要信息在标题中。
  • @BenVoigt 感谢您的澄清,但我试图指出 OP 只是不要在标题的开头放置像 Java: 这样的语言标签,因为这通常不受欢迎。但你的评论完全正确。
  • @Mike 你熟悉 PHP 吗?

标签: java windows ftp


【解决方案1】:

SAMBA!巴西三,巴西三三!

类似这样的:

String userPass = "username:password";
String filePath = "smb://ip_address/shared_folder/file_name";

NtlmPasswordAuthentication authentication = new NtlmPasswordAuthentication(userPass);
SmbFile smbFile = new SmbFile(filePath, authentication);
SmbFileOutputStream smbFileOutputStream = new SmbFileOutputStream(smbFile);
PrintStream printStream = new PrintStream(smbFileOutputStream);
//You should be good from this point on...             

注意:目标文件夹需要先共享!

【讨论】:

    【解决方案2】:

    正如@orm 已经指出的那样,这里已经回答了FTP upload via sockets

    基本上,您可以重用现有的库,例如 Apache Commons Net 来执行此操作。有关使用 FTP 客户端的详细信息,请查看documentation for the class FTPClient class

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-22
      • 2011-11-05
      • 1970-01-01
      • 2023-03-06
      • 2013-10-18
      • 1970-01-01
      相关资源
      最近更新 更多