I can't upload a multiple files to FTP by batch script

后端 未结 3 711
傲寒
傲寒 2020-12-20 07:54

I can\'t succeed to upload a multiple files to some FTP by batch file I made.

Also, I want to upload all files from this local directory.

The code:

3条回答
  •  时光说笑
    2020-12-20 08:01

    FTP command allows sending multiple files but if we want directories and sub-directories auto created and transferred then alternatively, we can use ncftp. Steps below:

    • Download NcFTP Client 3.2.6 for Microsoft Windows if you're using Windows PC for transferring files to Linux Server via FTP
    • Since, you're trying to send via batch file, we can use ncftpput command which is Internet file transfer program for scripts
    • Create batch file (say, ncftpupload.bat) and provide as:

    Syntax:

    ncftpput -u username -p password -m -R SERVER_IP_ADDRESS /remote_directory local_directory\*
    

    Example:

    ncftpput -u ftpuser1 -p ftppass1 -m -R 192.168.1.10 /var/www C:\public_html\*
    

    The switches used are:

    -u: FTP username
    -p: FTP password
    -m: Attempt to make the remote destination directory before copying.
    -R: Recursive mode; copy whole directory trees
    

提交回复
热议问题