Guest User

Untitled

a guest
Jan 17th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. for /f "delims=" %%x in (config.bat) do (set "%%x")
  2. echo Start[%time%] >> "%primefolder%TimeRun.log"
  3. REM --------------------------------------------------------------------------------------------
  4. REM Import .csv from the ftp server - csv imported to local directory
  5. REM Ftpcmd.txt connects to the ftp server and copies the .csv file to a local directory
  6. REM --------------------------------------------------------------------------------------------
  7. echo open %FTPIP%> %primefolder%ftpcmd.txt
  8. echo %FTPUsername%>> %primefolder%ftpcmd.txt
  9. echo %FTPPassword%>> %primefolder%ftpcmd.txt
  10. echo cd %FTPPrimary%>> %primefolder%ftpcmd.txt
  11. echo binary>> %primefolder%ftpcmd.txt
  12. echo lcd /D "%offload%" >> %primefolder%ftpcmd.txt
  13. echo mget %Filename%>> %primefolder%ftpcmd.txt
  14. echo disconnect>> %primefolder%ftpcmd.txt
  15. echo quit>> %primefolder%ftpcmd.txt
  16. REM -----------------------------------------------------------------------------------------------------------------------------
  17. REM Call and execute the FTP command text document (ftpcmd.txt)
  18. REM This Code calls the file which establishes a connection and then copies the file to a local directory
  19. REM Dynamic FTP command file is created and populated.
  20. REM -----------------------------------------------------------------------------------------------------------------------------
  21. ftp -i -s:"%primefolder%ftpcmd.txt" >"%primefolder%logsftpinport.log" 2>>"%primefolder%logsftperr.log"
  22. echo[%date% - %time%] >> "%primefolder%logsftpinport.log"
  23. ftp -i -d -s:%primefolder%ftpcmd.txt
  24. for /f "tokens=*" %%a in (%primefolder%logsftperr.log) do (echo [%date% - %time%] [Error Level: 1][Issue Location:FTP][Error:%%a] >> "%primefolder%logserror.log")
  25.  
  26. primefolder=C:scripts
  27. FTPIP=111.11.1.1
  28. FTPUsername=User
  29. FTPPassword=test
  30. Filename=User.csv
  31. FTPPrimary=CSV
  32. FTPArchive=CSVArchive
  33. offload=\test.orgtest_thisImplementationNew ProjectsNewInterface
  34.  
  35. ftp> open 111.11.1.1
  36. Connected to 111.11.1.1.
  37. 220 Welcome to Code-Crafters Ability FTP Server.
  38. User (111.11.1.1:(none)):
  39. 331 Please send PASS now.
  40.  
  41. 230-Welcome "User".
  42. 230-There are currently 1 of 100 users logged onto this server.
  43. 230-There are currently 1 users logged onto this account.
  44. 230-You have unlimited KB of account allocation left.
  45. 230-You have 0 transfer credits remaining.
  46. 230-You lose 0 credits per KB downloaded.
  47. 230-You lose 0 credits per KB uploaded.
  48. 230 You are currently in directory "/".
  49. ftp> cd CSV
  50. 250 "/CSV" is current directory.
  51. ftp> binary
  52. 200 Type set to 'I' (IMAGE).
  53. ftp> get User.csv \test.orgtest_thisImplementationNew ProjectsNewInterfaceUser.csv
  54. 200 PORT command successful.
  55. 150 Data connection established, beginning transfer.
  56. 226 Transfer complete.
  57. ftp: 1277532 bytes received in 2.64Seconds 483.91Kbytes/sec.
  58. ftp> disconnect
  59. 221 Thanks for visiting.
  60. ftp> quit
  61.  
  62. ftp> open 111.11.1.1
  63. Connected to 111.11.1.1
  64. 220 Welcome to Code-Crafters Ability FTP Server.
  65. User (111.11.1.1:(none)):
  66. 331 Please send PASS now.
  67.  
  68. 230-Welcome "User".
  69. 230-There are currently 2 of 100 users logged onto this server.
  70. 230-There are currently 1 users logged onto this account.
  71. 230-You have unlimited KB of account allocation left.
  72. 230-You have 0 transfer credits remaining.
  73. 230-You lose 0 credits per KB downloaded.
  74. 230-You lose 0 credits per KB uploaded.
  75. 230 You are currently in directory "/".
  76. ftp> cd CSV
  77. 250 "/CSV" is current directory.
  78. ftp> binary
  79. 200 Type set to 'I' (IMAGE).
  80. ftp> get User.csv \test.orgtest_thisImplementationNew ProjectsNewInterfaceUser.csv
  81. 200 PORT command successful.
  82. 150 Data connection established, beginning transfer.
  83. > R:I/O Error
  84. 226 Transfer complete.
  85. ftp: 1277532 bytes received in 2.84Seconds 449.20Kbytes/sec.
  86. ftp> disconnect
  87. 221 Thanks for visiting.
  88. ftp> quit
  89.  
  90. echo get %Filename% "%offload%%Filename%" >> %primefolder%ftpcmd.txt
  91.  
  92. echo lcd /D "%offload%" >> %primefolder%ftpcmd.txt
  93.  
  94. winscp.com /log=winscp.log /command ^
  95. "open ftp://%FTPUsername%:%FTPPassword%@%FTPIP%/" ^
  96. "cd %FTPPrimary%" ^
  97. "get %Filename% %offload%" ^
  98. "exit" > "%primefolder%logsftpinport.log"
Add Comment
Please, Sign In to add comment