Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #!/bin/bash
  2. username=$LOGNAME
  3. # put your password and the name of computer A here
  4. password=mypassword
  5. server=name_of_computer_A
  6. rm files.txt
  7. /usr/bin/wget ftp://$username:$password@$server/files.txt
  8. cat files.txt | \
  9. while read line
  10. do
  11. whattodo=`echo $line | cut -d ' ' -f1`
  12. filename=`echo $line | cut -d ' ' -f2`
  13. echo
  14. echo next command: $whattodo $filename
  15. echo
  16. case ${whattodo} in
  17. get)
  18. echo getting $filename ...
  19. /usr/bin/wget ftp://$username:$password@$server/$filename
  20. ;;
  21. put)
  22. echo putting $filename ...
  23. /usr/local/bin/wput $filename ftp://$username:$password@$server
  24. ;;
  25. cd)
  26. cd $filename
  27. pwd
  28. ;;
  29. ls)
  30. ls -l > results.txt
  31. /usr/local/bin/wput results.txt ftp://$username:$password@$server
  32. ;;
  33. done)
  34. echo finished
  35. ;;
  36. esac
  37. done
  38. echo done > files.txt
  39. /usr/local/bin/wput files.txt ftp://$username:$password@$server
  40. rm files.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement