JScript Posted November 12, 2012 Share Posted November 12, 2012 Very nice UDF, thanks 4 shared JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Syed23 Posted November 28, 2012 Share Posted November 28, 2012 Not a stupid question, but your script is not right. Your parameters to GUICtrlCreateAvi are wrong (see the help file). And you need to use BitOR to combine styles, not BitAND. I did notice though that AutoIt seems to have repainting issues on the AVI if you minimize the window, the AVI no longer seems to play until it loops and starts over again (but this has nothing to do with my UDF). Here's a fixed version of your script with the addition of a filename label and a few fixes, to show that it's working. expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <_LargeFileCopy.au3> #include "RecFileListToArray.au3" #include"Array.au3" #include <GUIConstantsEx.au3> #include <AVIConstants.au3> Global $msg, $timer, $ret Global $src, $SrcBut, $SrcLab, $Srcres Global $Dest, $DestLab, $DestBut, $DestRes, $GetList, $go, $ani1, $label _Main() Func _Main() GUICreate("File Copy", 550, 300) $SrcLab = GUICtrlCreateLabel("Select Source Folder", 5, 10, 110, 40) $src = GUICtrlCreateInput("", 115, 5, 400, 20) $SrcBut = GUICtrlCreateButton("...", 520, 5, 25, 20) $DestLab = GUICtrlCreateLabel("Select Destination Folder", 5, 60, 110, 40) $Dest = GUICtrlCreateInput("", 115, 55, 400, 20) $DestBut = GUICtrlCreateButton("...", 520, 55, 25, 20) $go = GUICtrlCreateButton("Copy Large File", 200, 150, 150, 50) ; ACS_AUTOPLAY is not doing anything, playback stops as soon as you hide the control $ani1 = GUICtrlCreateAvi(@SystemDir & "shell32.dll", 165, 10, 230, 275, 75, BitOR($ACS_CENTER, $ACS_TRANSPARENT)) GUICtrlSetState(-1, $GUI_HIDE) $label = GUICtrlCreateLabel("", 10, 210, 540, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $SrcBut Then $Srcres = FileSelectFolder("Select Folder", @DesktopDir, 1) GUICtrlSetData($src, $Srcres) EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $DestBut Then $DestRes = FileSelectFolder("Select Folder", @DesktopDir, 1) GUICtrlSetData($Dest, $DestRes) EndIf If $msg = $go Then If GUICtrlRead($src) = "" Then MsgBox(48, "Source Path - Warning", "Source path can not be blank") ElseIf GUICtrlRead($Dest) = "" Then MsgBox(48, "Destination Path - Warning", "Destination path can not be blank") ElseIf GUICtrlRead($src) <> "" And GUICtrlRead($Dest) <> "" Then GUICtrlSetState($ani1, $GUI_SHOW) GUICtrlSetState($ani1, 1) ; apparently this is needed, as $GUI_HIDE stops playback $timer = TimerInit() $GetList = _RecFileListToArray(GUICtrlRead($src) & "", "*", 0, 1, 1) ;Exit If IsArray($GetList) Then For $i = 0 To UBound($GetList) - 1 GUICtrlSetData($label, $GetList[$i]) $ret = _LargeFileCopy(GUICtrlRead($src) & "" & $GetList[$i], GUICtrlRead($Dest) & "" & $GetList[$i], BitOR(1, 2, 8)) Next EndIf GUICtrlSetData($label, "") GUICtrlSetState($ani1, $GUI_HIDE) EndIf EndIf WEnd EndFunc ;==>_Main I am sorry for bothering you.. still that hangs when the copy process goes in background Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
wraithdu Posted November 28, 2012 Author Share Posted November 28, 2012 You need to be more specific. "still that hangs" - What hangs? The AVI issue I mentioned is an AutoIt problem and not related to the UDF. "goes in background" - What goes where, how and when? Unless you get the classic 'this application is not responding' dialog with the offer to forcefully kill the process, then whatever 'hanging' you're experiencing is not related to the UDF. It could even be your AV program actively scanning a large file which will hang up even my UDF if it's aggressive enough. Link to comment Share on other sites More sharing options...
ilko Posted January 29, 2013 Share Posted January 29, 2013 (edited) First off- thanks for this great UDF.I've tested and used it only with file copy to USB sticks, here are some results you may find interesting.Legend:LFC 0.25, XP , 379.41LFC- LargeFileCopy buffered0.25- buffer used for LFC- _LargeFileCopy($src, $dest, BitOR(1, 2, 8, 128, 512), $buffer * 1024 * 1024, $CALG_MD5)379.41- seconds to finishXP- I386 folder from XP SP3 Setup CD, being copied from the internal hard disk, 5878 small files, 375MB total.ISO- two ISO files, 414MB and 495MBFileCopy- AutoIt internal FileCopy functionWFileCopy- Windows xcopy - Windows xcopy with /q and /h switches. Xcopy and LFC unbuffered took a lot more time so weren't tested at all.YCopy- Yashied's Tested in FAT16, FAT32, NTFS with a fast USB 2.0 stick- A and quite slow one-B, under XP SP3 and 7 x64, tests were repeated several times with format before each test, default cluster size for 4GB partition, AV turned off.A, under XP===============NTFS=============LFC 0.25, XP , 124.96LFC 0.25, ISO , 57.11LFC 0.5, XP , 154.68LFC 0.5, ISO , 173.81LFC 1, XP , 143.39LFC 1, ISO , 120.71LFC 2, XP , 133.38LFC 2, ISO , 87.61LFC 4, XP , 133.78LFC 4, ISO , 71.54LFC 8, XP , 129.07LFC 8, ISO , 60.94LFC 16, XP , 127.24LFC 16, ISO , 56.5xcopy, XP , 135.18xcopy,ISO , 46.31FileCopy , XP , 128.31FileCopy , ISO , 46.33WFileCopy , XP , 0.32WFileCopy , ISO , 46.32YCopy , XP , 154.1YCopy , ISO , 44.28===============Fat 16============LFC 0.25, XP , 160.53LFC 0.25, ISO , 58.06LFC 0.5, XP , 159.38LFC 0.5, ISO , 55.52LFC 1, XP , 159.9LFC 1, ISO , 54.06LFC 2, XP , 157.06LFC 2, ISO , 52.34LFC 4, XP , 154.45LFC 4, ISO , 52.76LFC 8, XP , 159.14LFC 8, ISO , 52.79LFC 16, XP , 150.89LFC 16, ISO , 52.88xcopy, XP , 185.33xcopy,ISO , 51.21FileCopy , XP , 155.35FileCopy , ISO , 50.03WFileCopy , XP , 0.05WFileCopy , ISO , 51.33YCopy , XP , 178.05YCopy , ISO , 50.26===============Fat 32============LFC 0.25, XP , 177.03LFC 0.25, ISO , 59.61LFC 0.5, XP , 173.95LFC 0.5, ISO , 55.82LFC 1, XP , 167.27LFC 1, ISO , 54.53LFC 2, XP , 168.64LFC 2, ISO , 54.25LFC 4, XP , 172.99LFC 4, ISO , 51.37LFC 8, XP , 152.86LFC 8, ISO , 52.84LFC 16, XP , 170.97LFC 16, ISO , 53.84xcopy, XP , 206.25xcopy,ISO , 50.92FileCopy , XP , 169.8FileCopy , ISO , 51.15WFileCopy , XP , 0.04WFileCopy , ISO , 51.62YCopy , XP , 181.01YCopy , ISO , 50.57A, under Windows 7===============NTFS=============LFC 0.25, XP , 379.41LFC 0.25, ISO , 49.57LFC 0.5, XP , 401.51LFC 0.5, ISO , 48.83LFC 1, XP , 405.99LFC 1, ISO , 48.59LFC 2, XP , 400.09LFC 2, ISO , 47.65LFC 4, XP , 399.18LFC 4, ISO , 49.7LFC 8, XP , 397.1LFC 8, ISO , 48.07LFC 16, XP , 397.45LFC 16, ISO , 48.28xcopy, XP , 569.33xcopy,ISO , 49.7FileCopy , XP , 377.08FileCopy , ISO , 49.91WFileCopy , XP , 404.86WFileCopy , ISO , 50.28YCopy , XP , 406.69YCopy , ISO , 50.18===============Fat 16============LFC 0.25, XP , 117.95LFC 0.25, ISO , 44.34LFC 0.5, XP , 156.83LFC 0.5, ISO , 42.33LFC 1, XP , 156.99LFC 1, ISO , 41.47LFC 2, XP , 158.42LFC 2, ISO , 41.35LFC 4, XP , 157LFC 4, ISO , 41.21LFC 8, XP , 157.85LFC 8, ISO , 41.25LFC 16, XP , 160.97LFC 16, ISO , 61.21xcopy, XP , 178.43xcopy,ISO , 41.35FileCopy , XP , 149.71FileCopy , ISO , 40.32WFileCopy , XP , 163.25WFileCopy , ISO , 40.59YCopy , XP , 148.88YCopy , ISO , 40.5===============Fat 32============LFC 0.25, XP , 114.1LFC 0.25, ISO , 45.84LFC 0.5, XP , 152.42LFC 0.5, ISO , 42.75LFC 1, XP , 153.22LFC 1, ISO , 42.01LFC 2, XP , 169.16LFC 2, ISO , 41.85LFC 4, XP , 153.72LFC 4, ISO , 41.74LFC 8, XP , 152.91LFC 8, ISO , 41.83LFC 16, XP , 156.06LFC 16, ISO , 60.91xcopy, XP , 173.69xcopy,ISO , 43.07FileCopy , XP , 142.32FileCopy , ISO , 40.94WFileCopy , XP , 115.86WFileCopy , ISO , 41.3YCopy , XP , 143.08YCopy , ISO , 41.03B, under Windows 7===============NTFS=============LFC 0.25, XP , 747.8LFC 0.25, ISO , 165.11LFC 0.5, XP , 705.83LFC 0.5, ISO , 163.25LFC 1, XP , 724.65LFC 1, ISO , 163.6LFC 2, XP , 668.09LFC 2, ISO , 164.18LFC 4, XP , 685.93LFC 4, ISO , 163.48LFC 8, XP , 657.66LFC 8, ISO , 164.7LFC 16, XP , 686.28LFC 16, ISO , 162.81xcopy, XP , 715.94xcopy,ISO , 172.56FileCopy , XP , 626.53FileCopy , ISO , 162.05WFileCopy , XP , 712.84WFileCopy , ISO , 159.22YCopy , XP , 666.32YCopy , ISO , 160.87===============Fat 16============LFC 0.25, XP , 742.78LFC 0.25, ISO , 170.15LFC 0.5, XP , 791.88LFC 0.5, ISO , 160.17LFC 1, XP , 754.53LFC 1, ISO , 156.01LFC 2, XP , 778.32LFC 2, ISO , 154.28LFC 4, XP , 784.73LFC 4, ISO , 153.31LFC 8, XP , 778.35LFC 8, ISO , 153.1LFC 16, XP , 784.75LFC 16, ISO , 168.92xcopy, XP , 832.92xcopy,ISO , 152.01FileCopy , XP , 778.39FileCopy , ISO , 151.43WFileCopy , XP , 838.63WFileCopy , ISO , 152.23YCopy , XP , 798.12YCopy , ISO , 151.12===============Fat 32============LFC 0.25, XP , 814.16LFC 0.25, ISO , 178.34LFC 0.5, XP , 862.87LFC 0.5, ISO , 170.46LFC 1, XP , 846.75LFC 1, ISO , 167.16LFC 2, XP , 852.09LFC 2, ISO , 164.55LFC 4, XP , 866.86LFC 4, ISO , 166.16LFC 8, XP , 862.91LFC 8, ISO , 164.63LFC 16, XP , 833.4LFC 16, ISO , 186.34xcopy, XP , 917.72xcopy,ISO , 158.97FileCopy , XP , 851.13FileCopy , ISO , 162.71WFileCopy , XP , 859.61WFileCopy , ISO , 162.83YCopy , XP , 890.42YCopy , ISO , 163Did not have patience to repeat the test with the slow stick under XP, but resluts were quite informative for me- LFC flies with small files when the proper buffer is used.For large files, above say 100-200MB I couldn't get it not the freeze the GUI- it does not freeze during copying, but once finished, until windows file system buffer/cache is emptied, it gets frozen. For files above, say 500MB it's quite noticable, can't recall if optimize for performace/quick removal policy helped or not, but wasn't a path to take anyway. Ended up using copy.exe and ProcessGetStats, like As a side note- _LFC_GetDiskClusterSize function seems to need a correction, return should be $aRet[3]*$aRet[2], BytesPerSector*SectorsPerCluster, unless you had other intentions. Edited January 29, 2013 by ilko Link to comment Share on other sites More sharing options...
Syed23 Posted January 30, 2013 Share Posted January 30, 2013 Hi , Thank you so much for this wonderful script. with help of this tool i created a tool which made my job so easy. But i have a doubt when i copy the file from source location to destination location date is getting changed. could you please help me how to avoid changing the date? sorry for bothering you. Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
ilko Posted January 30, 2013 Share Posted January 30, 2013 @Sayed23 Use the appropriate flag(s): ; #FUNCTION# ==================================================================================================== ; Name...........: _LargeFileCopy ; Description....: Copy large files in such a way as to keep AutoIt GUIs responsive ; Syntax.........: _LargeFileCopy($sSrc, $sDest[, $iFlags = 0[, $iToRead = 2097152[, $iAlg = $CALG_MD5[, $sFunction = ""[, $vUserVar = Default]]]]]) ; Parameters.....: $sSrc - Source file name ; $sDest - Destination: may be a file name or directory ; $iFlags - [Optional] Combine flags with BitOR ; | 1 - Overwrite existing file ; | 2 - Create destination directory structure ; | 4 - Flush the destination file buffer before returning ; | 8 - Verify source and destination are identical via bit by bit comparison ; | 16 - Verify source and destination are identical via MD5 hash ; | 32 - Verify source and destination file size only ; | 64 - Copy source file attributes (NOT including Compression or Encryption) ; | 128 - Copy source file Creation time ; | 256 - Copy source file Last Accessed time ; | 512 - Copy source file Modified time ; |1024 - Copy source file Security Descriptors and Ownership ; |2048 - Copy source compression state ; |4096 - Copy source encryption state Link to comment Share on other sites More sharing options...
Syed23 Posted January 30, 2013 Share Posted January 30, 2013 Thank you @iLko.. will be the below syntax correct? $mds = _LargeFileCopy(GUICtrlRead($DrivePath) & $Docs & "\" & $DocsAr[$i], "C:\Users\" & @UserName & "\Documents" & "\" & $DocsAr[$i], BitAND(BitOR(1, 2, 8),(128,256,512))) Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
ilko Posted January 30, 2013 Share Posted January 30, 2013 Nope. Combine all parameters needed in a single BitOR- BitOR(1, 2, 8, 128, 512) or whatever you need inside. Syed23 1 Link to comment Share on other sites More sharing options...
wraithdu Posted January 31, 2013 Author Share Posted January 31, 2013 As a side note- _LFC_GetDiskClusterSize function seems to need a correction, return should be $aRet[3]*$aRet[2], BytesPerSector*SectorsPerCluster, unless you had other intentions. I actually caught this bug, and I thought I uploaded a fixed version. My local sources are fixed, I had moved some more functions into FileEx, so not sure what happened. Anyway, I'll update shortly. Link to comment Share on other sites More sharing options...
VenusProject2 Posted April 16, 2015 Share Posted April 16, 2015 (edited) Thank you, your script is still being appreciated... Edited April 17, 2015 by VenusProject2 Link to comment Share on other sites More sharing options...
JibsMan Posted September 25, 2015 Share Posted September 25, 2015 I have used _LargeFileCopy before and it worked great! Thanks for the script! However with a new script I'm having problems.Wraithdu, (or anyone!) do you know why FileCopy and _LargeFileCopy fails? DirCopy does work.I get a Zero (0) returned when I run my code using either FileCopy or _LargeFileCopy_LargeFileCopy.au3 is in the C:\Program Files (x86)\AutoIt3\Include directory.My actual script does a lot more than this, so I toned it down to only do the copy. I used _LargeFileCopy in a script last year and it worked perfectly.#include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <_LargeFileCopy.au3> #include <File.au3> Local $sSourceTestDir = "C:\Validation\214" ;Source is 3 Dirs Deep, over 12,000 files, 400MB Local $sDestTestDir = "C:\FileCopyTest\214" ;Empty Dir MsgBox($MB_OK,"","Source Dir is "&$sSourceTestDir&" and Dest Dir is "&$sDestTestDir&". Copy Files Next!",5) ;$iRes = FileCopy($sSourceTestDir,$sDestTestDir,$FC_OVERWRITE + $FC_CREATEPATH) ;$iRes = _LargeFileCopy($sSourceTestDir,$sDestTestDir,1) $iRes = DirCopy($sSourceTestDir, $sDestTestDir,$FC_OVERWRITE) MsgBox($MB_OK,"","$iRes is "&$iRes,10)I have created the Sink directories C:\FileCopyTest\214 while trying to get _LargeFileCopy working. However DirCopy creates these if they are not there.I have tried adding backslashes ( C:\Validation\214\ ), asterisks, ( C:\Validation\214\* ) & ( C:\Validation\214\*.* ) to the code.I have made both the Source and Sink directories Shared, Full Control for Everyone and turned off Read Only attributes.I would prefer to use the _LargeFileCopy because of the progress bar showing the darned script is actually doing something instead of waiting, not knowing if the script is stuck or working.I have tried this on multiple systems; Windows 10, Windows 8.1 and get the same results. I'm pulling out my hair trying to figure out what I'm doing wrong!Any help is certainly appreciated!JibsMan Link to comment Share on other sites More sharing options...
GhostLine Posted July 8, 2016 Share Posted July 8, 2016 Back from the deads ... I've the same issue here, but it's something I think I can manage. I've only two regrets : - it miss a post copy control to see if it is about to rewrite the exact same file - it miss lot of return (for example, the MD5 key, or the detailled output when there's an error while copying, etc.) wraithdu , have you ever considered to extend the functionalities of this tool ? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now