以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 在FTP服务器里建立路径失败 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=190681) |
-- 作者:mxl810823 -- 发布时间:2024/2/28 8:33:00 -- 在FTP服务器里建立路径失败 如下代码是往FTP服务器里写入路径的,但是有时候能成功,有时却是没有建立任何路径也没有报错,是什么原因?本来我是直接执行“ ftpm.MakeDir ("" & lg & "") ”一次建立的,也是有时可以,大部分时候不可以 Dim rq As String = "2025" Dim cb As String = "f55" Dim gd As String = "f85" Dim lb As String = "j622f" Dim lga As String = "" & "\\" & "资料图片\\" & "" & rq & "" & "\\" & "" Dim lgb As String = "" & "\\" & "资料图片\\" & "" & rq & "" & "\\" & "" & cb & "" & "\\" & "" Dim lgc As String = "" & "\\" & "资料图片\\" & "" & rq & "" & "\\" & "" & cb & "" & "\\" & "" & gd & "" & "\\" & "" Dim lg As String = "" & "\\" & "资料图片\\" & "" & rq & "" & "\\" & "" & cb & "" & "\\" & "" & gd & "" & "\\" & "" & lb & "" & "\\" & "" If ftpm.DirExists ("" & lga & "") = False Then ftpm.MakeDir ("" & lga & "") If ftpm.DirExists ("" & lgb & "") = False Then ftpm.MakeDir ("" & lgb & "") If ftpm.DirExists ("" & lgc & "") = False Then ftpm.MakeDir ("" & lgc & "") If ftpm.DirExists ("" & lg & "") = False Then ftpm.MakeDir ("" & lg & "") End If End If End If End If
|
-- 作者:有点蓝 -- 发布时间:2024/2/28 9:11:00 -- 借用Q群里【潭】回复的用法 Dim lg As String = "\\" & "资料图片\\" & rq & "\\" & cb & "\\" & gd & "\\" & lb Dim lgjoin As String = "" For Each l As String In lg.Split("\\") lgjoin = lgjoin & "\\" & l If ftpm.DirExists (lgjoin) = False Then ftpm.MakeDir (lgjoin) End If Next 1楼的问题在于,如果lga已经存在,就不会再执行if里面的代码了
|