kuldietercastel

get.bat

Mar 2nd, 2013
59
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM get.bat
  2. REM Gets all files from the toSend directory of the given username to the outputDir directory.
  3. REM
  4. REM Description:
  5. REM     This script has to be used with the pscp.exe of the putty suite.
  6. REM     You can find putty here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
  7. REM
  8. REM Version:    1.0
  9. REM Author:     Dieter Castel
  10. REM License:    Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  11. REM             See: http://creativecommons.org/licenses/by-nc-sa/3.0/ for more info.
  12.  
  13. REM Variables
  14. REM     Changes where the files will be coppied to.
  15. set outputDir=.\recieved
  16. REM     Changes where the file will be copied from. Mind the wildcard to get all files.
  17. set remoteDir=/toSend/*
  18.  
  19. @echo off
  20. REM Asks for your user name.
  21. set /p user="Enter your ssh user name:"
  22. echo "Retrieving all files in /home/student/%user%/toSend"
  23. REM Uses putty copy
  24. REM -v for verbose messaging
  25. REM -r to copy all directories recursivly
  26. REM -2 force to use ssh2
  27. REM -scp use the scp protocol
  28. REM -unsafe allow serverside wildcards
  29. pscp -v -r -2 -scp -unsafe %user%@st.cs.kuleuven.be:/home/student/%user%%remoteDir% %outputDir%
  30. REM Pause to show what happend.
  31. pause
RAW Paste Data