filecopy
kill
filecopy & kill

解决方案 »

  1.   

    移动文件可以用API函数  MoveFile
    所有操作都可以通过API函数SHFileOperation实现
      

  2.   

    我一般都是用fso来操作,比较直观,
    比如:
    dim fso as new filesystemobject
    dim myfolder as folderfso.movefolder
    fso.deleterfolder
    fso.copyfolder
    (没上机调试,手工打的,可能有错误,还有,记得引用microsoft scripting runtime
      

  3.   

    Private Const FO_COPY = &H1
    Private Const FO_MOVE = &H2
    Private Const FO_DELETE = &H3
    Private Const FOF_NOCONFIRMATION = &H10
    Private Const FOF_SILENT = &H4
    Private Const FOF_NOERRORUI = &H400
    Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
    Private Type SHFILEOPSTRUCT
            hWnd As Long
            wFunc As Long
            pFrom As String
            pTo As String
            fFlags As Integer
            fAnyOperationsAborted As Long
            hNameMappings As Long
            lpszProgressTitle As String '  only used if FOF_SIMPLEPROGRESS
    End TypePublic Function FileOpt(ByVal sSourceFile As String,ByVal sDestFile As String) As Boolean
        Dim udtPath As SHFILEOPSTRUCT
        udtPath.hWnd = 0
        udtPath.wFunc = FO_COPY '拷贝文件 FO_MOVE 移动文件 FO_DELETE 删除文件
        udtPath.pFrom = sSourceFile
        udtPath.pTo = sDestFile
        udtPath.fFlags = FOF_NOCONFIRMATION
        FileOpt = Not CBool(SHFileOperation(udtPath))
    End Function
      

  4.   

    Private Declare Function SHFileOperation Lib _
    "shell32.dll" (ByRef lpFileOp As _
    SHFILEOPSTRUCT) As LongPrivate Const ERROR_SUCCESS = 0&
    Private Const FO_COPY = &H2
    Private Const FO_DELETE = &H3
    Private Const FO_MOVE = &H1
    Private Const FO_RENAME = &H4
    Private Const FOF_ALLOWUNDO = &H40
    Private Const FOF_CONFIRMMOUSE = &H2
    Private Const FOF_FILESONLY = &H80
    Private Const FOF_MULTIDESTFILES = &H1
    Private Const FOF_NOCONFIRMATION = &H10
    Private Const FOF_NOCONFIRMMKDIR = &H200
    Private Const FOF_RENAMEONCOLLISION = &H8
    Private Const FOF_SILENT = &H4
    Private Const FOF_SIMPLEPROGRESS = &H100
    Private Const FOF_WANTMAPPINGHANDLE = &H20Private Type SHFILEOPSTRUCT
            hwnd As Long
            wFunc As Long
            pFrom As String
            pTo As String
            fFlags As Integer
            fAnyOperationsAborted As Long
            hNameMappings As Long
            lpszProgressTitle As String '  only used if FOF_SIMPLEPROGRESS
    End Type
      

  5.   

    FileCopy   复制
    Kill       删除
    Name       移动
      

  6.   

    还是xxlroad(土八路) 的方法好!土八路厉害呀
    (真丢人,俺竟然忘了这种方法    ^_^ )