【问题标题】:Samba: When I try to delete a file I get - jcifs.smb.SmbException: The system cannot find the file specified?Samba:当我尝试删除文件时,我得到 - jcifs.smb.SmbException:系统找不到指定的文件?
【发布时间】:2017-12-16 22:26:11
【问题描述】:

我在连接到 smb 服务器后尝试删除文件夹中的一个文件或所有文件的测试

def fullPath ="smb://XXXXX/XXX/XX/qa/"  
def smbFile = new SmbFile(fullPath, new NtlmPasswordAuthentication("","USERNAME","PASSWORD") )  
println ("SMB files -" +smbFile.listFiles())

返回 SMB files -[smb://XXXX/XXX/XX/qa/xyz.csv]

现在如果我跑

smbFile.delete("xyz.csv")

文件已删除,但我得到 - jcifs.smb.SmbException: The system cannot find the file specified. - 我的测试失败了

【问题讨论】:

  • 想通了,很抱歉提出并回答我自己的问题

标签: spock samba jcifs


【解决方案1】:

终于想通了,如果我改用这个
smbFile.listFiles().each {(it.delete())}

猜猜问这个问题让我想了更多。

【讨论】:

    猜你喜欢
    • 2015-09-28
    • 1970-01-01
    • 2013-12-30
    • 2022-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多