以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- MoveDirectory (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=127027) |
-- 作者:huhu -- 发布时间:2018/11/3 10:21:00 -- MoveDirectory MoveDirectory 将目录中的内容移到另一个目录,并删除原目录。 语法: MoveDirectory(Directory, Destination) Directory: 要移动的目录 例如: FileSys.MoveDirectory("C:\\YourFolder", "D:\\MyFolder") 代码 Dim r As Row = Tables("组查询版本_table2").Current Dim id As Integer = user.name.IndexOf("@") Dim str As String = user.name.SubString(0,id) If e.Sender.Checked Then If MessageBox.show("版本流水号:" & r("编号") & "确定要停用?","中式通知停用?",MessageBoxButtons.YesNo,MessageBoxIcon.Question) = DialogResult.Yes Then r("停用人员邮箱") = user.Name r("停用人员") = str r("停用时间") = Date.now Dim str1 As String = r("测试组名") & "/temp/" & r("编号") r.save Dim ftp As New FtpClient ftp.Host="192.168.1.35" ftp.Account = "tester" ftp.Password = "tester" If ftp.DirExists(str1) = False Then ftp.MakeDir(str1) msgbox(0) FileSys.MoveDirectory(r("版本目录"), str1) msgbox(1) r("版本目录") = str1 r("完整路径") = "\\\\192.168.1.35\\bdcom\\route_bin" & "/" & r("版本目录") msgbox(2) r.save End If
Else e.Sender.Checked = False End If End If 执行FileSys.MoveDirectory(r("版本目录"), str1)报错 未能找到目录“开发者/DEV2018100057”。 可是有这个目录啊 |
-- 作者:有点蓝 -- 发布时间:2018/11/3 10:27:00 -- ftp要这样用:http://www.foxtable.com/webhelp/scr/1410.htm 重命名目录: Dim ftp1 As New FtpClient FileSys.MoveDirectory不能用于ftp |
-- 作者:huhu -- 发布时间:2018/11/3 10:39:00 -- 关键是我想将目录中的内容移到另一个目录,并删除原目录。 就是剪切效果。 Dim r As Row = Tables("组查询版本_table2").Current Dim id As Integer = user.name.IndexOf("@") Dim str As String = user.name.SubString(0,id) If e.Sender.Checked Then If MessageBox.show("版本流水号:" & r("编号") & "确定要停用?","中式通知停用?",MessageBoxButtons.YesNo,MessageBoxIcon.Question) = DialogResult.Yes Then r("停用人员邮箱") = user.Name r("停用人员") = str r("停用时间") = Date.now Dim str1 As String = r("测试组名") & "/temp/" & r("编号") r.save Dim ftp As New FtpClient ftp.Host="192.168.1.35" ftp.Account = "tester" ftp.Password = "tester" If ftp.Rename(r("版本目录"),str1) Then msgbox(0) r("版本目录") = str1 r("完整路径") = "\\\\192.168.1.35\\bdcom\\route_bin" & "/" & r("版本目录") End If Else e.Sender.Checked = False End If End If 没成功啊。另外我想问一下之前目录是A/B,那么rename可以改为A/temp/B?
[此贴子已经被作者于2018/11/3 11:23:12编辑过]
|
-- 作者:有点蓝 -- 发布时间:2018/11/3 11:49:00 -- 到底使用的是ftp还是共享还?这完全是两回事,不要混用好吗! 截图说明真正的文件路径是怎么样的
|
-- 作者:huhu -- 发布时间:2018/11/3 11:56:00 -- ftp方式。
|
-- 作者:有点蓝 -- 发布时间:2018/11/3 13:28:00 -- ftp设置的根目录是什么? |
-- 作者:huhu -- 发布时间:2018/11/3 14:04:00 -- ![]() ![]() |
-- 作者:有点蓝 -- 发布时间:2018/11/3 14:10:00 -- 创建ftp的时候,指定的目录是什么? If ftp.Rename(r("版本目录"),str1) Then msgbox(0) r("版本目录") = str1 r("完整路径") = "/" & r("版本目录") End If |
-- 作者:huhu -- 发布时间:2018/11/3 14:32:00 -- "\\\\192.168.1.35\\bdcom\\route_bin"------这是ftp进入之后的目录,指定的根目录。就是输入账号和密码登录直接就进入了bdcom\\route_bin目录了。 |
-- 作者:有点蓝 -- 发布时间:2018/11/3 15:19:00 -- If ftp.Rename(r("版本目录"),str1) Then msgbox(0) r("版本目录") = str1 r("完整路径") = "/" & r("版本目录") End If
|