Jump to content
Sign in to follow this  

counting files that were copied

Recommended Posts


Hi there,

I have a neat little script which copies files from A to B.

The amount of files is variable frfom time to time and I now want to add a msgbox which count's the number of files which were copied. Any idea?

I didn't find a way in the help files or when searching the board here... ^_^

Share this post

Link to post
Share on other sites


search for copywithprogress

;Copy with Progressbar
#Include <File.au3>

_copyProgress("C:\Downloads\Fotos\Frisur\", 'C:\Downloads\Fotos\Frisur\Test\', '*.jpeg')

Func _copyProgress($From_dir, $Dest_dir, $filter = '*.*')
    Local $count = 0, $dir = ""
    $FileList = _FileListToArray($From_dir, $filter, 0)
    If(Not IsArray($FileList)) And(@error = 1) Then SetError(-1)
    ProgressOn("Copy", "Files :", "0 files")
    For $i = 1 To UBound($FileList) - 1
        If FileGetAttrib($FileList[$i]) = "D" Then $dir = "\*.*"
        If FileCopy($From_dir & "\" & $FileList[$i] & $dir, $Dest_dir & "\", 9) Then
            $count += 1
            ProgressSet($count * 100 / $FileList[0], _
                    "From: " & $From_dir & "\" & @LF & "To: " & $Dest_dir & "\" & @LF & $FileList[$i], _
                    StringFormat('%05.2f', Round(($count * 100 / $FileList[0]), 2)) & " % " & @TAB & $count & "/" & $FileList[0] & " Done")
        Sleep(100); to see what happens
    ProgressSet(100, "Done", "Complete")
    Return 1
EndFunc  ;==>_copyProgress


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post

Link to post
Share on other sites

Thanks mate! I will test this ^_^

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this