Domanda

I have a batch file that runs every night in which it ftps a file over. In that batch I have this line echo send C:\send*.txt>> ftpcmd.dat. This works perfectly when there is only one file in the send folder and I only want to send one file the newest one, but when there are numerous files sometimes it sends the newest one sometimes it doesn't. Im not sure what determines what file is sent when I use a '*' as the filename.

@echo off
echo user > ftpcmd.dat
echo psswd> ftpcmd.dat
echo ascii>> ftpcmd.dat
echo send C:\newgdrive\boldata\send\*.txt>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat ftp.thinktbl.com
del ftpcmd.dat
È stato utile?

Soluzione

The send command correctly transmits a single file to the server.

In order to transmit multiple files, you may use mput instead of send.

Also, commands acting on multiple files such as mput cause prompting (y/n) - you may want to disable this by calling prompt before using mput.

Your ftpcmd.dat should look like this:

user vigftp
mypwd
ascii
prompt
mput C:\newgdrive\boldata\send\*.txt
quit
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top