Need a unique gift idea?
A Pastebin account makes a great Christmas gift

NQ Sync

sweenig Jan 15th, 2014 241 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. ::version 1.1 updated 10/4/2012
  2. @echo off
  3. set masterserver=
  4. for %%p in (z y x w v u s t r q p o n m l k j i h g f e d c b a) do (
  5.         if not exist %%p:\nul (
  6.                 set masterdriveletter=%%p
  7.                 echo Drive letter %%p will be used for the master network drive.
  8.                 goto masterfound
  9.         )
  10. )
  11. :masterfound
  12. for %%p in (z y x w v u s t r q p o n m l k j i h g f e d c b a) do (
  13.         if not %%p==%masterdriveletter% (
  14.                 if not exist %%p:\nul (
  15.                         set remotedriveletter=%%p
  16.                         echo Drive letter %%p will be used for the remote network drive.
  17.                         goto remotefound
  18.                 )
  19.         )
  20. )
  21. :remotefound
  22. set updatetool=N
  23. set gathercigs=N
  24. set synctools=N
  25. :Loop
  26. if "%1"=="" GOTO Continue
  27. ::if /u or /U is specified, update the support cig tool itself
  28. if "%1"=="/u" set updatetool=Y && GOTO VarSet  
  29. if "%1"=="/U" set updatetool=Y && GOTO VarSet
  30. ::if /g or /G is specified, gather the cig files
  31. if "%1"=="/g" set gathercigs=Y && GOTO VarSet
  32. if "%1"=="/G" set gathercigs=Y && GOTO VarSet
  33. ::if /s or /S is specified, sync the tools directories
  34. if "%1"=="/s" set synctools=Y && GOTO VarSet
  35. if "%1"=="/S" set synctools=Y && GOTO VarSet
  36. ::get the server list
  37. set serverlist=%1
  38. :VarSet
  39. SHIFT
  40. GOTO Loop
  41. :Continue
  42. set willit=will not
  43. if %updatetool%==Y set willit=will
  44. echo NQSync %willit% update SupportCIG.exe using the version on %masterserver%.
  45. set willit=will not
  46. if %gathercigs%==Y set willit=will
  47. echo NQSync %willit% gather the SupportCIG output files to %masterserver%.
  48. set willit=will not
  49. if %synctools%==Y set willit=will
  50. echo NQSync %willit% update the DBTools3 and SupportTools6 folders using the versions on %masterserver%.
  51. echo Connecting to master server...
  52. net use %masterdriveletter%: \\%masterserver%\d$
  53. FOR /F %%A IN (%serverlist%) DO (
  54.         echo Connecting to %%A...
  55.         net use %remotedriveletter%: \\%%A\d$
  56.         ::this section updates the supportcig tool itself.  This has to be done almost every month.
  57.         if %updatetool%==Y (
  58.                 echo Updating remote CIG on %%A...
  59.                 if not exist %remotedriveletter%:\SupportCIG md %remotedriveletter%:\SupportCIG
  60.                 copy %masterdriveletter%:\SupportCIG\SupportCIG.exe %remotedriveletter%:\SupportCIG\SupportCIG.exe /y
  61.         )
  62.         ::this section gathers the support cigs from the remote server
  63.         if %gathercigs%==Y (
  64.                 echo Gathering CIGs from %%A...
  65.                 if not exist %masterdriveletter%:\SupportCIG\%%A md %masterdriveletter%:\SupportCIG\%%A
  66.                 if exist %remotedriveletter%:\SupportCIG\*.zip (
  67.                         copy %remotedriveletter%:\SupportCIG\*.zip %masterdriveletter%:\SupportCIG\%%A\*.zip
  68.                         del /q %remotedriveletter%:\SupportCIG\*.zip
  69.                 )
  70.                 if not exist %remotedriveletter%:\SupportCIG\*.zip echo No CIGs found on %%A.
  71.         )
  72.         ::this section pushes out the contents of %masterdriveletter%:\DBTools3 and %masterdriveletter%:\SupportTools6
  73.         if %synctools%==Y (
  74.                 echo Updating remote SupportTools, DBTools, and backup scripts on %%A...
  75.                 xcopy %masterdriveletter%:\DBTools3 %remotedriveletter%:\DBTools3 /E /Y /I /Q
  76.                 xcopy %masterdriveletter%:\SupportTools6 %remotedriveletter%:\SupportTools6 /E /Y /I /Q
  77.         )
  78.         echo Disconnecting from %%A...
  79.         net use %remotedriveletter%: /delete
  80.         echo.
  81. )
  82. echo Disconnecting from master server...
  83. net use %masterdriveletter%: /delete
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand