Batch for remote ftp dowlaods
Moderator: DosItHelp
Batch for remote ftp dowlaods
What up, I'm new to writing batch jobs in fact i really don't know anything about the other than saving them as .bat.
Well, on to the matter at hand. I need to know how to create a batch file for ftp downloads from a hosting domain. Anyone have any ideas thanks.
Well, on to the matter at hand. I need to know how to create a batch file for ftp downloads from a hosting domain. Anyone have any ideas thanks.
Code: Select all
@echo off
rem Your FTP username
set ftpUser=USERNAME
rem Your FTP password
set ftpPass=PASSWORD
rem Your FTP server IP
set ftpIP=192.168.0.2
set ftpFile=%temp%\TempAcc.txt
>"%ftpFile%" echo.%ftpUser%
>>"%ftpFile%" echo.%ftpPass%
>>"%ftpFile%" echo bin
>>"%ftpFile%" echo mget *.*
>>"%ftpFile%" echo bye
start ftp -v -i -s:"%ftpFile%" %ftpIP%
-
- Posts: 6
- Joined: 17 Jun 2009 20:17
- Location: http://vietdzung.net
- Contact:
Batcher wrote:Code: Select all
@echo off
rem Your FTP username
set ftpUser=USERNAME
rem Your FTP password
set ftpPass=PASSWORD
rem Your FTP server IP
set ftpIP=192.168.0.2
set ftpFile=%temp%\TempAcc.txt
>"%ftpFile%" echo.%ftpUser%
>>"%ftpFile%" echo.%ftpPass%
>>"%ftpFile%" echo bin
>>"%ftpFile%" echo mget *.*
>>"%ftpFile%" echo bye
start ftp -v -i -s:"%ftpFile%" %ftpIP%
Tks very much,
But, I wanna Send 1 file (Not MGET *.*) each day at one time. How can I ?
(If date=12 then send c:\12.abc
Loop it for all days in month)
-
- Expert
- Posts: 80
- Joined: 04 Feb 2009 10:03
Code: Select all
Set "ftpFile=Script.ftp"
Set "Day=%Date:~3,2%" REM Get Day of Month
Echo UserID > %ftpFile%
Echo Password >> %ftpFile%
Echo bin >> %ftpFile%
Echo lcd >> %ftpFile%
Echo cd >> %ftpFile%
Echo Put %Day%.abc >> %ftpFile%
Echo bye >> %ftpFile%
start ftp -v -i -s:"%ftpFile%" %ftpIP%
-
- Posts: 319
- Joined: 12 May 2006 01:13
if you can have gawk for win32
save the above as myscript.awk and on command line
Code: Select all
BEGIN{
ftpfile="Script.ftp"
ftpip = "xx.xx.xx.xx"
day = strftime("%d",systime())
print "UserID" > ftpfile
print "Password" > ftpfile
print "bin" > ftpfile
print "lcd" > ftpfile
print "cd somewhere" > ftpfile
print "put "day".abc" > ftpfile
print "bye" > ftpfile
cmd="ftp -v -i -s:"ftpfile" "ftpip
print cmd
system(cmd)
system("del "ftpfile)
}
save the above as myscript.awk and on command line
Code: Select all
c:\workspace\> gawk -f myscript.awk
-
- Posts: 319
- Joined: 12 May 2006 01:13
RElliott63 wrote:Code: Select all
...
Set "Day=%Date:~3,2%" REM Get Day of Month
....
getting day like this is dependent on regional settings. make it independent of it.
-
- Posts: 6
- Joined: 17 Jun 2009 20:17
- Location: http://vietdzung.net
- Contact: