Advertisement
J2897

Robocopy - Copy

Oct 13th, 2015
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.08 KB | None | 0 0
  1. :: Released under the GNU General Public License version 3 by J2897.
  2.  
  3. :: This script will copy everything in the SOURCE folders in the DESTINATION folders. The timestamps will be preserved. The security permissions will be discarded.
  4.  
  5. :: Note: Files that already exist in the DESTINATION may be overwritten.
  6.  
  7. @echo OFF
  8.  
  9. REM Custom variables.
  10. set "TASKNAME=Migrate NAS1"
  11. set "SOURCE=\\NAS1\FreeNAS"
  12. set "DESTINATION=J:\NAS1\FreeNAS"
  13.  
  14. REM Fixed variables.
  15. set "LOGFOLDER=%USERPROFILE%\RoboCopy Logs"
  16. set "LOGFILE=%LOGFOLDER%\%TASKNAME%.log"
  17. set "TAB=   "
  18.  
  19. REM Preparation.
  20. title %TASKNAME%
  21. pushd "%~dp0"
  22. if not exist "%LOGFOLDER%" (md "%LOGFOLDER%")
  23.  
  24. REM Display.
  25. echo Copying . . .
  26. echo.
  27. echo SOURCE:%TAB%%TAB%%SOURCE%
  28. echo DESTINATION:%TAB%%DESTINATION%
  29.  
  30. REM Main RoboCopy command.
  31. robocopy.exe "%SOURCE%" "%DESTINATION%" *.* /E /NP /R:100 /W:30 /Z /LOG:"%LOGFILE%" /XJ /XD "J:\$RECYCLE.BIN" "J:\System Volume Information" /XF "desktop.ini"
  32.  
  33. REM Finish up.
  34. explorer /select,"%LOGFILE%"
  35. popd
  36. echo.
  37. pause
  38.  
  39. :End
  40. echo.
  41. echo Ending . . .
  42. timeout /t 4 /nobreak >nul
  43. exit /b 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement