Just search the forums for
SHFileOperation. SKAN's version seems to be available still
http://www.autohotke...ion#entry125953.
And here's another one from the ancient AHK_Basic days (may work though):
#NoEnv
Quelle := "D:\AHK"
Ziel := "E:\AHK_SAV"
MsgBox, % _CopyDirEx_(Quelle, Ziel, 2, "ahk,ini,txt")
ExitApp
; ------------------------------------------------------------------------------
; _CopyDirEx_()
;
; Funktion:
; Kopieren von Verzeichnissen mit erweiterter Funktionalität.
; 1. Gui mit Fortschrittsanzeige
; 2. Löschen des Zielverzeichnisses vor dem Kopieren
; 3. Auswahl bestimmter Dateien mittels Suchmuster
;
; Parameter:
; Source Quellverzeichnis
; Dest Zielverzeichnis
; Optional: Flag 0 = Dateien im Zielverzeichnis nicht überschreiben
; 1 = Dateien im Zielverzeichnis überschreiben
; 2 = Zielverzeichnis ggf. vor dem Kopieren löschen
; Standard: 1
; Optional: Pattern Dateiauswahlmuster (z.B. "*.ahk") oder Komma-getrennte
; Liste von Dateierweiterungen (z.B. "ahk,ini,hlp")
; Standard: "" = "*.*"
; Bei Vorgabe eines Suchmusters werden Ordner, die keine
; entsprechenden Dateien enthalten, nicht übernommen!
; Optional: Gui Guinummer
; Standard: 77
;
; Danksagung:
; Mein spezieller Dank gilt Superfraggle, ahklerner und tonne für
; [url="http://www.autohotkey.com/forum/post-143928.html"]http://www.autohotke...ost-143928.html[/url]
; ------------------------------------------------------------------------------
_CopyDirEx_( Source
, Dest
, Flag = 1
, Pattern = ""
, Gui = 77 )
{
Global _CDE_Gui
Global _CDE_PGB1
Global _CDE_PGB2
Global _CDE_TotalSize
Global _CDE_CopiedFile
Global _CDE_CopiedTotal
Global _CDE_Cancel
; ---------------------------------------------------------------------------
; Statische Variablen
Static OverWrite := 1
Static DeleteDest := 2
Static Callback := 0
; ---------------------------------------------------------------------------
; Sprachabhängige Konstanten
Static TXGIN := " Copy"
Static TXSIN := "Source:`t`t"
Static TXDIN := "Destination:`t"
Static TXCIN := "Cancel"
Static TXTIN := "Total: "
Static TXS1IN := " Getting files ..."
Static TXS2IN := " File "
Static TXS3IN := " of "
Static TXS4IN := " Done!"
Static TXS5IN := " Terminated!"
Static TXM1IN := "Error while copying file "
Static TXM2IN := "Size of source: "
Static TXM3IN := "Size of copy: "
Static TXM4IN := "Copying will be terminated!"
Static TXG07 := " Kopieren"
Static TXS07 := "Quelle:`t"
Static TXD07 := "Ziel:`t"
Static TXC07 := "Abbruch"
Static TXT07 := "Gesamt: "
Static TXS107 := " Dateien werden ermittelt ..."
Static TXS207 := " Datei "
Static TXS307 := " von "
Static TXS407 := " Fertig!"
Static TXS507 := " Abgebrochen!"
Static TXM107 := "Fehler beim Kopieren der Datei "
Static TXM207 := "Originalgröße: "
Static TXM307 := "Größe der Kopie: "
Static TXM407 := "Das Kopieren wird abgebrochen!"
; ---------------------------------------------------------------------------
; Gui
Static T1
; ---------------------------------------------------------------------------
; Spracheinstellung
LANG := "IN"
If (SubStr(A_Language, 3) = "07") {
LANG := "07"
}
; ---------------------------------------------------------------------------
; Parameter auswerten
_CDE_Gui := Gui
If (Pattern = "") {
Pattern := "*.*"
} Else If InStr(Pattern, ",") {
MEXT := Pattern
Pattern := "*.*"
}
; ---------------------------------------------------------------------------
; Zielverzeichnis ggf. löschen?
If (Flag = DeleteDest) {
If (FileExist(Dest)) {
FileRemoveDir, %Dest% , 1
}
}
; ---------------------------------------------------------------------------
; Gui
Gui, %Gui%:Default
Gui, +AlwaysOnTop +Toolwindow +OwnDialogs +LastFound +Label_CDE_Gui_
Gui, Margin, 10, 10
Gui, Add, Text, Section, % TXS%LANG% . Source
Gui, Add, Text, xs y+5, % TXD%LANG% . Dest
Gui, Add, Button, x330 ys w80 g_CDE_Gui_Close, % TXC%LANG%
Gui, Add, Text, xs w400 vT1
Gui, Add, Progress, xm y+3 wp v_CDE_PGB1 -Smooth, 0
Gui, Add, Text, xm y+5 wp, % TXT%LANG%
Gui, Add, Progress, xm y+3 wp v_CDE_PGB2 -Smooth, 0
Gui, Add, StatusBar, , % TXS1%LANG%
Gui, Show, , % TXG%LANG%
; ---------------------------------------------------------------------------
; Anzahl der Dateien und Gesamtgröße ermitteln
_CDE_TotalSize := 0
Files := 0
Paths := ""
Loop, %Source%\%Pattern%, % Pattern = "*.*" ? 1 : 0, 1
{
If (Flag = 0) {
StringReplace, NewFile, A_LoopFileLongPath, %Source%, %Dest%
If (FileExist(NewFile)) {
Continue
}
}
If (MEXT) {
If A_LoopFileExt Not In %MEXT%
Continue
}
Paths .= A_LoopFileLongPath . "`n"
If !(InStr(FileExist(A_LoopFileLongPath), "D")) {
_CDE_TotalSize += A_LoopFileSize
Files++
}
}
; ---------------------------------------------------------------------------
; Dateien kopieren
If !(Callback) {
Callback :=RegisterCallback("_CDE_Progress")
}
_CDE_CopiedTotal := 0
_CDE_Cancel := False
Loop, Parse, Paths, `n
{
If (A_Index > Files) {
Break
}
If (InStr(FileExist(A_LoopField), "D")) {
FileCreateDir, %A_LoopField%
Continue
}
SB_SetText(TXS2%LANG% . A_Index . TXS3%LANG% . Files)
FileGetSize, FileSize, %A_LoopField%
StringReplace, NewFile, A_LoopField, %Source%, %Dest%
SplitPath, NewFile, , Dir
If !(FileExist(Dir))
FileCreateDir, %Dir%
GuiControl, , T1, %A_LoopField%
GuiControl, , _CDE_PGB1, 0
_CDE_CopiedFile := 0
RetVal := DllCall("CopyFileEx"
, Str , A_LoopField
, Str , NewFile
, Uint, Callback
, Uint, 0
, Int, _CDE_Cancel
, Int, 0)
Sleep, -1
If (_CDE_Cancel) {
Break
}
If (RetVal = 0 Or ErrorLevel != 0 Or FileSize > _CDE_CopiedFile) {
MsgBox, 4112, _CopyDir_
, % TXM1%LANG% . NewFile . "!`n`n"
. "RetVal: " . RetVal . " *`n"
. "A_LastError: " . A_LastError . " *`n"
. TXM2%LANG% . FileSize . " *`n"
. TXM3%LANG% . _CDE_CopiedFile . " *`n`n"
. TXM4%LANG%
FileDelete, %NewFile%
Return False
}
_CDE_CopiedTotal += FileSize
}
; ---------------------------------------------------------------------------
; Fertig!
SB_SetText(_CDE_Cancel ? TXS5%LANG% : TXS4%LANG%)
Sleep, 2000
Gui, %Gui%:Destroy
Return True
; ---------------------------------------------------------------------------
_CDE_Gui_Close:
_CDE_Gui_Escape:
_CDE_Cancel := True
Return
}
; ------------------------------------------------------------------------------
; Callback-Funktion für die Fortschrittsanzeige
_CDE_Progress(P1L, P1H, P2L, P2H, P3L, P3H, P4L, P4H, P5, P6, P7, P8, P9) {
; LARGE_INTEGER TotalFileSize (2 * Integer)
; LARGE_INTEGER TotalBytesTransferred (2 * Integer)
; LARGE_INTEGER StreamSize (2 * Integer)
; LARGE_INTEGER StreamBytesTransferred (2 * Integer)
; DWORD dwStreamNumber
; DWORD dwCallbackReason
; HANDLE hSourceFile
; HANDLE hDestinationFile
; LPVOID lpData
Global _CDE_Gui
Global _CDE_PGB1
Global _CDE_PGB2
Global _CDE_TotalSize
Global _CDE_CopiedFile
Global _CDE_CopiedTotal
Global _CDE_Cancel
FileSize := (P1H << 32) + P1L
_CDE_CopiedFile := (P2H << 32) + P2L
GuiControl, %_CDE_Gui%:, _CDE_PGB1
, % Round(_CDE_CopiedFile / FileSize * 100)
GuiControl, %_CDE_Gui%:, _CDE_PGB2
, % Round((_CDE_CopiedFile + _CDE_CopiedTotal) / _CDE_TotalSize * 100)
Return _CDE_Cancel
}