Foxtable(狐表)用户栏目专家坐堂 → [求助]处理文件代码


  共有2183人关注过本帖树形打印复制链接

主题:[求助]处理文件代码

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110597 积分:562881 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/9/1 9:50:00 [显示全部帖子]

Dim dir As String = "D:\项目"
For Each file As String In FileSys.GetFiles(dir)
    Dim filename As String = FileSys.GetName(file)
    Dim arr() As String = filename.Split("-")
    Dim subdir As String = dir & "\" & arr(0)
    If Not FileSys.DirectoryExists(subdir) Then FileSys.CreateDirectory(subdir)
    FileSys.MoveFile(file,subdir & "\" & filename)
Next

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110597 积分:562881 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/9/1 11:00:00 [显示全部帖子]

http://www.foxtable.com/webhelp/scr/0337.htm


Dim dir As String = "D:\项目"
For Each file As String In FileSys.GetFiles(dir)
    Dim filename As String = FileSys.GetName(file)
    Dim arr() As String = filename.Split("-")
    Dim subdir As String = dir & "\" & arr(0)
    If Not FileSys.DirectoryExists(subdir) Then FileSys.CreateDirectory(subdir)
    Dim fg As Boolean = True
    If FileSys.FileExists(subdir & "\" & filename) Then
        If MessageBox.Show("是否覆盖?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No Then
            fg = False
        Else
            FileSys.DeleteFile(subdir & "\" & filename,2,3)
        End If
    End If
    If fg Then FileSys.MoveFile(file,subdir & "\" & filename)
Next

 回到顶部