1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Public Sub test()
Dim lpFindFileData As WIN32_FIND_DATA
Dim hFindFile As Long
Dim fileName As String
Dim CurPath$, TargetPath$, SourcePath$, i&
CurPath = "\\?\c:\temp\source\*.*"
SourcePath = "\\?\c:\temp\source\"
TargetPath = "\\?\c:\temp\target\"
hFindFile = FindFirstFile(CurPath, lpFindFileData)
If hFindFile <> INVALID_HANDLE_VALUE Then
Do
fileName = Mid$(lpFindFileData.cFileName, 1, InStr(lpFindFileData.cFileName, Chr$(0)) - 1)
If fileName <> "." And fileName <> ".." Then
MsgBox CopyFileW(StrConv(SourcePath & fileName, vbUnicode), StrConv(TargetPath & fileName, vbUnicode), 0) & vbCrLf & fileName
End If
Loop Until FindNextFile(hFindFile, lpFindFileData) = 0
End If
FindClose hFindFile
End Sub |
Partager