Jump to content

Recommended Posts

Posted

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... ^_^

Posted

Hi,

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")
        EndIf
        Sleep(100); to see what happens
    Next
    ProgressSet(100, "Done", "Complete")
    Sleep(500)
    ProgressOff()
    Return 1
EndFunc  ;==>_copyProgress

Mega

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

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
×
×
  • Create New...