Uploading file to FTP server in a particular folder location

12,050

The put command takes optional second argument, where you specify a target path.

Though you have to know the FTP path. You cannot use the local Windows path (local as of the server).

So if, for example, the D:\ is the FTP root, the FTP path of the D:\SuccessTransaction will be like /SuccessTransaction.

Then the put command will be like:

put D:\Files\Success*.csv /SuccessTransaction/Success.csv

If you want to keep the changing source name, you need to use cd and mput:

cd /SuccessTransaction
mput D:\Files\Success*.csv
Share:
12,050
Sudipta Roy
Author by

Sudipta Roy

Bibliophile | Numismatist | Foodie

Updated on June 27, 2022

Comments

  • Sudipta Roy
    Sudipta Roy almost 2 years

    I am uploading a file to a remote server (Ex. 123.45.678.90) using batch file and the log shows successfully transferred the file.

    Whereas in that server (123.45.678.90) I am unable to locate that file. Please suggest how do I transfer the file to a particular folder in the server [D:\SuccessTransaction].

    @echo off
    ping 127.0.0.1 -n 20 -w 60000 > nul
    
    del ftpcmd.dat
    
    echo user myuser>> ftpcmd.dat
    echo mypassword>> ftpcmd.dat
    echo BINARY>> ftpcmd.dat
    echo put D:\Files\Success*.csv>> ftpcmd.dat
    echo quit>> ftpcmd.dat
    ftp -n -s:ftpcmd.dat 123.45.678.90 >> FileUploadLog.txt
    del ftpcmd.dat