Guest User

Untitled

a guest
Aug 21st, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. REM Demo-script as asked on http://www.reddit.com/r/usenet/comments/2e47km/nzbget_script_help/
  3. goto start
  4. ###########################################################
  5. ### NZBGET POST-PROCESSING SCRIPT
  6.  
  7. # Move files to another directory.
  8. #
  9. # NOTE: The script doesn't have a proper error handling. If the
  10. # destination directory contains files with the same names the new
  11. # files are not copied but silently deleted.
  12.  
  13. ###########################################################
  14. ### OPTIONS
  15.  
  16. # Final destination directory.
  17. #
  18. # Directory to move downloaded files to.
  19. #FinalDir=C:\Downloads\Final
  20.  
  21. ### NZBGET POST-PROCESSING SCRIPT
  22. ###########################################################
  23.  
  24. :start
  25.  
  26. REM Error codes used by NZBGet
  27. SET POSTPROCESS_SUCCESS=93
  28. SET POSTPROCESS_NONE=95
  29. SET POSTPROCESS_ERROR=94
  30.  
  31. echo [DETAIL] Script started
  32.  
  33. REM Don't move files for failed downloads
  34. if "%NZBPP_TOTALSTATUS%" NEQ "SUCCESS" (
  35.     echo [INFO] Download has failure status, don't moving any files
  36.     exit /b %POSTPROCESS_NONE%
  37. )
  38.  
  39. if "%NZBPO_FINALDIR%" EQU "" (
  40.     echo [ERROR] Please set option FinalDir in the script settings
  41.     exit /b %POSTPROCESS_ERROR%
  42. )
  43.  
  44. echo [DETAIL] Moving files
  45. move %NZBPP_DIRECTORY%\* %NZBPO_FINALDIR%
  46.  
  47. echo [DETAIL] Deleting old directory (should be empty but who knows?)
  48. rmdir /q %NZBPP_DIRECTORY%
  49.  
  50. REM Let NZBGet know where the files were moved (this path is shown in history details dialog)
  51. echo [NZB] FINALDIR=%NZBPO_FINALDIR%
  52.  
  53. exit /b %POSTPROCESS_SUCCESS%
Add Comment
Please, Sign In to add comment