faustf Posted May 21, 2018 Share Posted May 21, 2018 hi guys this is my udf i want share with comunity i hope you like , is not perfect but perfectible thankz at all expandcollapse popup#include <File.au3> #include <Date.au3> ;_FileCopyLOG("C:\Users\SviluppoGest\Desktop\ba", "C:\Users\SviluppoGest\Desktop\ma", "C:\Users\SviluppoGest\Desktop\back.txt", "", "",1,1) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _FileCopyLOG ; Description ...: File copy and log with Robocopy ; Syntax ........: _FileCopyLOG($Path, $DestPath, $LogPath, $FlagFTA = 0, $Flag = 0, $cmdflag = 0, $visible = 0) ; Parameters ....: $Path - dirctory you wish copy ; $DestPath - base directory where output goes ; $LogPath - log path if you want log , if you dont want simply "" ; $FlagFTA - flag option of _FileListToArray (see help for details) ; $Flag - flag option Robocopy (see help robocopy for details,cmd --> robocopy /? ) ; $cmdflag - flag option for command Run (see help for Eun cmmand, usally c or k) ; $visible - flag for see cmd (active or disactive @SW_HIDE) ; Return values .: ; Author ........: Faustf ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: decomment 5° line and insert your path ; =============================================================================================================================== Func _FileCopyLOG($Path, $DestPath, $LogPath, $FlagFTA = 0, $Flag = 0, $cmdflag = 0, $visible = 0) If $FlagFTA = Default Then $FlagFTA = 0 If $Flag = 0 Then $Flag = "/E" If $cmdflag = 0 Then $cmdflag = "c" Else $cmdflag = "k" EndIf If $visible = 0 Then $visible = "" Else $visible = @SW_HIDE EndIf Local $aFileList = _FileListToArray($Path, "*.*", $FlagFTA) ;_ArrayDisplay($aFileList) If @error = 1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Return 1 ElseIf @error = 4 Then ; MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Return 4 ElseIf @error = 2 Then ; MsgBox($MB_SYSTEMMODAL, "", "Invalid Filter") Return 2 ElseIf @error = 3 Then ; MsgBox($MB_SYSTEMMODAL, "", "Invalid Flag") Return 3 Else If @OSVersion = "WIN_XP" Then Local $sLRoboFileDir = FileGetShortName(@ProgramFilesDir & '\Windows Resource Kits\Tools\robocopy.exe ') Local $sLFromShort = FileGetShortName($Path) Local $sLToShort = FileGetShortName($DestPath) Local $sLOptShort = FileGetShortName($Flag) Local $sLOgShort = FileGetShortName($LogPath) If FileExists($sLRoboFileDir) Then If $LogPath = "" Then Run(@ComSpec & ' /k ' & $sLRoboFileDir & ' ' & $sLFromShort & ' ' & $sLToShort & ' ' & $sLOptShort ,'', $visible)) Else Run(@ComSpec & ' /k ' & $sLRoboFileDir & ' ' & $sLFromShort & ' ' & $sLToShort & ' ' & $sLOptShort & ' /LOG:' & $sLOgShort,'', $visible) EndIf Else MsgBox(48, 'Info', 'You must install robocopy') ShellExecute("https://www.microsoft.com/en-us/download/details.aspx?id=17657") EndIf Else If FileExists(@SystemDir & '\robocopy.exe') Then If $LogPath = "" Then Run(@ComSpec & ' /'&$cmdflag&' ' & @SystemDir & '\robocopy.exe ' & $Path & ' ' & $DestPath & ' ' & $Flag,'', $visible) Else Run(@ComSpec & ' /'&$cmdflag&' ' & @SystemDir & '\robocopy.exe ' & $Path & ' ' & $DestPath & ' ' & $Flag & ' /LOG:' & $LogPath, '', $visible) EndIf Else MsgBox(48, 'Info', 'You must install robocopy') ShellExecute("https://www.microsoft.com/en-us/download/details.aspx?id=17657") EndIf EndIf Return 5 EndIf EndFunc ;==>_FileCopyLOG ; #INDEX# ======================================================================== ; Title .........: GUI_Configure.au3 ; AutoIt Version : 3.3.14.2++ ; Language ......: Italian ; Description ...: A collection of Function for Logic of Gest ; Author ........: Faustf ; What do you do.: Write data in File ; Version .......: 0.0.1 BETA - Work in progress 15/03/2016 ; Syntax ........: ; ================================================================================ Func _True_write_File($sFilePath, $sDataWrite, $iReturn = 0) If $iReturn = Default Then $iReturn = 0 $File = FileOpen($sFilePath, 1) If $iReturn = 0 Then FileWrite($File, $sDataWrite & @CRLF) Else FileWrite($File, $sDataWrite) EndIf FileClose($File) EndFunc ;==>_True_write_File Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 21, 2018 Moderators Share Posted May 21, 2018 (edited) So you go through this thread, showing once again you don't understand the most basic of AutoIt concepts. Then once people have more or less spoon-fed it to you, you release a "UDF" which is basically nothing more than a cheesy wrapper for Robocopy??? Edited May 21, 2018 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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