anoniem Geplaatst: 9 september 2002 Delen Geplaatst: 9 september 2002 met onderstaande code lukt het me om [b:39ba98fab6]specifieke bestanden [/b:39ba98fab6]te kopieren Private Sub Knop3_Click() Dim SourceFile, DestinationFile SourceFile = "het bronbestand" DestinationFile = "het doelbestand" FileCopy SourceFile, DestinationFile End Sub maar hoe kan ik [b:39ba98fab6]een gehele map[/b:39ba98fab6] in een keer van a naar b kopieren? bvd PZ Quote Link naar reactie
anoniem Geplaatst: 10 september 2002 Auteur Delen Geplaatst: 10 september 2002 [code:1:45f56a0996]Option Compare Database Option Explicit 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 End Type Private Declare Function SHFileOperation Lib "shell32.dll" _ Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long Private Const FOF_ALLOWUNDO = &H40 Private Const FOF_NOCONFIRMATION = &H10 Private Const FO_COPY = &H2 Private Sub Knop3_Click() ShellFileCopy "C:\zz2\*.*", "C:\zzz" End Sub Public Function ShellFileCopy(src As String, dest As String, _ Optional NoConfirm As Boolean = False) As Boolean 'PURPOSE: COPY FILES VIA SHELL API 'THIS DISPLAYS THE COPY PROGRESS DIALOG BOX 'PARAMETERS: src: Source File (FullPath) dest: Destination File (FullPath) 'NoConfirm (Optional): If set to true, no confirmation box 'is displayed when overwriting existing files, and no 'copy progress dialog box is displayed 'Returns (True if Successful, false otherwise) 'EXAMPLE: 'dim bSuccess as boolean 'bSuccess = ShellFileCopy ("C:\MyFile.txt", "D:\MyFile.txt") Dim WinType_SFO As SHFILEOPSTRUCT Dim lRet As Long Dim lflags As Long lflags = FOF_ALLOWUNDO If NoConfirm = True Then lflags = lflags & FOF_NOCONFIRMATION With WinType_SFO .wFunc = FO_COPY .pFrom = src .pTo = dest .fFlags = lflags End With lRet = SHFileOperation(WinType_SFO) ShellFileCopy = (lRet = 0) End Function [/code:1:45f56a0996] Bovenstaande code heb ik ooit een van internet gehaald. vervang FileCopy SourceFile, DestinationFile door ShellFileCopy SourceFile\*.*, DestinationFile Quote Link naar reactie
anoniem Geplaatst: 10 september 2002 Auteur Delen Geplaatst: 10 september 2002 of simpeler: [code:1:3fd38d9634]x=shell "xcopy "+map$+ "/K"[/code:1:3fd38d9634](niet getest) Quote Link naar reactie
anoniem Geplaatst: 10 september 2002 Auteur Delen Geplaatst: 10 september 2002 hmm jah maar komt er dan geen dosbox? Quote Link naar reactie
anoniem Geplaatst: 10 september 2002 Auteur Delen Geplaatst: 10 september 2002 [quote:c81bc74a79="Johan Stokking"]hmm jah maar komt er dan geen dosbox?[/quote:c81bc74a79] hangt er van af: er is d8 ik ook een optie die het minimaliseert, bovendien kan je >nul toevoegen: "xcopy "+map$+" /K >nul" Quote Link naar reactie
Aanbevolen berichten
Om een reactie te plaatsen, moet je eerst inloggen