Reputation: 359
I found some posts on similar issues but I did not make my problem to work. I want to use Windows Task on Windows Server 2012 to copy the content of some folders to back them up on a FTP server.
I created a filebakup.bat
and entered these lines
@echo off
echo user myusername> ftpcmd.dat
echo mypassword>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo lcd /D "G:\Navi_Touren\Tour_2015\">> ftpcmd.dat *the local dir with many files to transfer
echo cd /backups/Tour_2015>> ftpcmd.dat *the Destination Folder on ftp
echo put *>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat myFTPserver.com
It does not work, it says "cannot open file" or similar error message.
I can only make it with one file
echo put "G:\Navi_Touren\Tour_2015\myfile.txt" "/backups/Navi Touren/myfile.txt">> ftpcmd.dat
But how to transfer all files in a certain directory?
Thanks Michael
Upvotes: 1
Views: 2780
Reputation: 202292
You need to use the mput *
, instead of the put
. The put
does not accept wildcards.
Plus you want to use the prompt
to disable confirmation of every selected file.
prompt
mput *
See also Batch file to upload all files in directory to FTP.
Also there no /D
switch in the lcd
command. Remove that. And the trailing backslash does not seem to work either.
lcd "G:\Navi_Touren\Tour_2015"
Upvotes: 2