Advertisement
garry2

Robocopy_AHK

Aug 25th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. I have a very small 4K Computer Beelink , Windows is on drive C:\
  2. My files are on Drive D:\ ,
  3. I copy from drive D:\ to E:\ the folders M_GARRY and M_IRENE and A_DESKTOP (C:\users\garry\desktop) to drive E:\_BEELINK ( see VT total drives =3 )
  4. a logfile is in folder %a_desktop%\ROBOCOPY_LOG which is excluded
  5. while running %cmd% pop up , at end see messagebox > COPY ended
  6. -------------------------------------
  7. try to copy this last example :
  8. ccc3 =%a_desktop%
  9. source3=%ccc3% ;
  10. dest3 =%last%_BEELINK\DESKTOP ; %last% means this should be the new connected drive , in your case maybe D:\ ( see VT total drives =3 )
  11. -------------------------------------
  12. [code]
  13. #warn
  14. Setworkingdir,%a_scriptdir%
  15.  
  16. fd1=%a_desktop%\ROBOCOPY_LOG
  17. ifnotexist,%fd1%
  18. filecreatedir,%fd1%
  19.  
  20. gosub,drivegetshow
  21.  
  22. ;---------------------------
  23. /*
  24. ccc1 =M_GARRY ; X:\M_GARRY
  25. source1=%seclast%%ccc1% ; source-1
  26. dest1 =%last%_BEELINK\%ccc1% ; dest1
  27.  
  28. ccc2 =M_IRENE
  29. source2=%seclast%%ccc2% ;
  30. dest2 =%last%_BEELINK\%ccc2% ;
  31. */
  32.  
  33. ;ccc3 =C:\users\garry\desktop
  34. ccc3 =%a_desktop%
  35. source3=%ccc3% ;
  36. dest3 =%last%_BEELINK\DESKTOP ;
  37.  
  38.  
  39.  
  40. ;---------------------------
  41. ;- beelink must have at least DRIVE E:\ ; VT= Total drives here 3
  42. if ((vt>2) and (type1="Removable" or type1="Fixed")) ;- if more then 2 drives & lastDrive is removable/ or fixed ( maybe USB-stick )
  43. {
  44. msgbox, 262436,COPY-%seclast% to %last% ,%alldrives%`n-------------`nWant you COPY =`n%source3%`n%dest3% ? ;- ask for the first folder to copy , in this case , example C:\users\garry\desktop to E:\_BEELINK\Desktop
  45. IfMsgBox,No
  46. return
  47. logfile ="%fd1%\%a_now%_Robocopy_Log.txt"
  48. excludex=%logfile%
  49.  
  50. ; runwait, %comspec% /c robocopy "%source1%" /LOG+:%logfile% "%dest1%" /XO /E,,
  51. ; runwait, %comspec% /c robocopy "%source2%" /LOG+:%logfile% "%dest2%" /XO /E,,
  52. runwait, %comspec% /c robocopy "%source3%" /LOG+:%logfile% "%dest3%" /XO /E /XD %excludex%,,
  53.  
  54. msgbox, 262208, ,COPY ended
  55. run,%logfile%
  56. }
  57. return
  58.  
  59.  
  60. ;--------------------------------------------------------------------------------------------------------
  61. drivegetshow:
  62. i=0
  63. alldrives:=""
  64. DriveGet, A, List,
  65. StringSplit,D, A,
  66. loop,%d0%
  67. {
  68. DRV:= % d%a_index% . ":\"
  69. i++
  70. DriveGet , type1 , type , %DRV% ;- removable / fixed
  71. DriveGet , cap1 , capacity , %DRV%
  72. DrivespaceFree , free1 , %DRV%
  73. DriveGet , fs1 , fs , %DRV% ;- FAT
  74. DriveGet , label1 , label , %DRV% ;- volume label >\\server1
  75. DriveGet , serial1 , serial , %DRV% ;- volume serial number
  76. DriveGet , status1 , status , %DRV%
  77. alldrives .= drv . " " . type1 . " " . free1 . "-MB`n"
  78. ;msgbox, 262208,Drive-Info_%i% ,%DRV% %type1% %label1% %fs1% %cap1%-MB %free1%-MB %status1%
  79. }
  80. stringtrimright,alldrives,alldrives,1
  81. VT:=D0 ;- totaldrives
  82. VL:=(D0-1) ;- totaldrives-1
  83. last = %drv%
  84.  
  85. if (VT>2)
  86. {
  87. loop,%vl%
  88. seclast := % d%a_index% . ":\"
  89. ;msgbox, 262208,Info ,Alldrives=`n%alldrives%
  90. }
  91. else
  92. {
  93. msgbox, 262208,ERROR-SAVE ,You need more than 2 drives for this computer BEELINK`n`nAlldrives=`n%alldrives%
  94. exitapp
  95. }
  96. return
  97. ;---------------------------------------------------------------------------------------------
  98. [/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement