Friday, November 10, 2017

Access FTP (FTP, FTPS & SFTP) anywhere without install

We have to do many things to access FTP on our day-to-day works. sometimes we write the same thing many times for the same...

Now, I am sharing my tool to upload/download/move/remove from/to FTP/FTPS/SFTP.. this tool has many options like access FTP through different port/SSH/TLS ...

DOWNLOAD HERE - FTP_Action.zip (4.7MB)

Description of this tool: all you have to do just create a command file and execute FTP_Action.exe with this command file. This command file can contain multiple FTP server access. That means you don't have to write separate command & run this for separate FTP servers. you can put all together and execute once. after executing the command file, it will generate a log file about the executed operations (you may skip this).

How to use:
  1. Extract the zip in a separate folder [in my case "C:\FTP_Tool"]
  2. you will find the below files - you have to always keep below file together in a location
    • FTP_Action.exe
    • FTP_Action.ReadMe
    • WinSCP.exe
    • WinSCPnet.dll
  3. Create the command file [in my case, command file is in "C:\SFTP\FTP_COMMAND.txt"]
    • See ReadMe\Sample Command Section file to create the command file
    • Open a text file.
    • write your commands.
    • save the file.
    • Command Example of Command file
      • open sftp://USER_NAME:PASSWORD@FTP_ADDRESS_OR_IP:PORT/ -SSH
      • put "C:\SFTP\TEST_UPLOAD.txt" "/Prod/TEST_UPLOAD.csv"
      • no need to add "bye" command. this tool will close session/connection when finished or open the next connection.
  4. Now i have command file and executable
    • FTP_Action in "C:\FTP_Tool\FTP_Action.exe"
    • Command file is "C:\SFTP\FTP_COMMAND.txt"
Now Execute the command file as below :
  1. open cmd/command prompt.
  2. go to "working location - C:\FTP_Tool" - optional/required if not work in other location
    • cd C:\FTP_Tool
  3. command - executable with file name (full path) as parameter
    • "C:\FTP_Tool\FTP_Action.exe" "C:\SFTP\FTP_COMMAND.txt"
  4. if you want a log file of this operation, then mention a log file name (full path) as second parameter
    • "C:\FTP_Tool\FTP_Action.exe" "C:\SFTP\FTP_COMMAND.txt" "C:\SFTP\FTP_COMMAND_LOG.log"
  5. if you want a system generated log file name, then mention a location (followde by '\') as second parameter instead of file name.
    • "C:\FTP_Tool\FTP_Action.exe" "C:\SFTP\FTP_COMMAND.txt" "C:\SFTP\"



Please Check the ReadMe File ....

Use below command to execute/use this tool …
-----------------------
From CMD/Command Prompt --
Command:
FTP_Action.exe COMMAND_PATH [LOG_PATH] [Options]

COMMAND_PATH : Full path of the command file. to create a command file see section "Command File Syntax"
LOG_PATH     : (optional) Full path of the log file. a log file would be generated after execution. If file name not mentioned, Log file name will contain DateTime info and a part of command file name [i.e. 20171102035012_CMD.log when the command file name is CMD.txt]

Command Options:
-SSL : only for SFTP connection
-TLS : this option is required if the FTP connection need KEY FingerPrint
-SSLI : this is required for secure FTP connection with Implicit encryption
-SSLE : this is required for secure FTP connection with Explicit encryption

example :

FTP_Action.exe "D:\tmp\SFTP\SFTP_COMMAND.txt"

FTP_Action.exe "D:\tmp\SFTP\SFTP_COMMAND.txt" "D:\tmp\SFTP\SFTP_COMMAND_LOG.log"

Command File Syntax ... [in this case - the file is "D:\tmp\SFTP\SFTP_COMMAND.txt"]
-----------------------
open sftp://USERNAME:PASSWORD@ABC123.rxcorp.com/ -SSH
put "D:\tmp\SFTP\TEST_UPLOAD.txt" "/mnt/sql/TEST_UPLOAD_PUT.csv"
mov "/mnt/sql/TEST_UPLOAD_PUT.csv" "/mnt/sql/TEST_UPLOAD_PUT_MOV.csv"
rnm "/mnt/sql/TEST_UPLOAD_PUT_MOV.csv" "/mnt/sql/TEST_UPLOAD_PUT_MOV_RNM.csv"
get "/mnt/sql/TEST_UPLOAD_PUT_MOV_RNM.csv" "D:\tmp\SFTP\TEST_UPLOAD_PUT_MOV_RNM_DWN.csv"
del "/mnt/sql/TEST_UPLOAD_PUT_MOV_RNM.csv"

open ftp://USERNAME:PASSWORD@192.44.12.94/
mkdir "/Prods/Data"
put "D:\tmp\SFTP\TEST_UPLOAD.txt" "/Prods/TEST_UPLOAD_PUT.csv"
get "/Prods/TEST_UPLOAD_PUT.csv" "D:\tmp\SFTP\TEST_UPLOAD_PUT_GET.txt"
del "/Prods/TEST_UPLOAD_PUT.csv"

How to install FTP_Action in other server
---------------------------------------------
copy below files together to any location. keep all files together in one place to work.
1. FTP_Action.exe
2. WinSCPnet.dll
3. WinSCP.exe
4. FTP_Action.ReadMe

No comments:

Post a Comment