Batch download zips from ftp - windows

Good evening.
Can You help me please with some batch file?
I have an ftp, where in root directory located few randomly named zip archives.
So i need to download that archives to local D:\temp
I know, how to do it via ftp.exe, but only for one file, witch name i know:
file: save.bat
ftp -s:1.txt
file: 1.txt
open myftp.com
123login
321pass
prompt
binary
hash
get file.zip D:\test\12.zip
bye
Maybe u can tell me how to download all * zip archives on ftp in loop?
Thanks!

You can use the mget command to download multiple files through ftp. This also supports wildcards.

You can simply use:
mget *.zip

Related

Download files of two types (*.bat and *.txt) using WinSCP get command

I am trying to download files of type *.bat and *.txt using WinSCP get command and put it in D:\example folder as shown below:
get /zjpw/*.* D:\example\
By above line I am getting all different type of files, but I want to get only .bat and .txt files. How do I achieve that?
Thanks in advance.
To download .bat and .txt files from /zjpw folder only:
get /zjpw/*.bat /zjpw/*.txt D:\example\
To download files even from subfolders:
get /zjpw/* D:\example\ -filemask=*.bat;*.txt
See https://winscp.net/eng/docs/scriptcommand_get

How to write command in windows batch file to copy a zip file from an FTP path to a local folder in my computer

I want to copy a zip file from an FTP path to a local folder in my computer.
My client previously used coreftp.exe for that purpose. But now he ask us to use ftp.exe [default in windows machine, available at C:\Windows\System32\ftp.exe] for that purpose. The ftp is in the format :
ftp://username#ftpserver.address.com
And want to download it to d:\sample\docs folder on my machine.
I want that in a batch file so that I can schedule it through windows task manager.
So could you please help me to write that command on the batch file.
Thanks a lot in advance.
FTP.EXE is capable of executing script files. So you could just put this into your bat file:
#ECHO OFF
CD d:\sample\docs
FTP -v -i -s:C:\some\path\ftpscript.txt
And something like this into your ftpscript.txt:
open ftp://ftpserver.address.com
username
password
cd myfolder
get some_zip_file.zip
disconnect
bye
This will download some_zip_file.zip into the current directory (d:\sample\docs).

Retrieve zip file from a predefined ftp link using bat or cmd file

I have a pre-defined ftp link with a zip file on the other end that I want to save to a directory on my cloud server (running Windows Server 2008). Once the zip file has been saved to a specified directory, lets say "c:\MyZipFiles\ZipFile-1.zip" for example, I want to unzip the file so that all files contained within the zip file are accessible within the same directory. I'm currently doing this manually and I want to automate this process by creating a .bat or .cmd file that will perform these steps for me.
Once the zip file is unzipped, I have a task in the Task Scheduler of Windows Server Manager ready to use the unzipped files for other things.
The pre-defined link looks something like this:
ftp://idx.realtor.com/idx_download/files.zip
I would greatly appreciate anyone who can help me with this...
Batch file
ftp -s:ftp_cmds.txt host-name-goes-here
unzip local-file.zip
exit
ftp_cmds.txt
username-goes-here
password-goes-here
cd remote-directory-goes-here
get files.zip local-file-name-goes-here.zip
quit
This the batch file uses "unzip" to unzip the archive you can find it here: http://gnuwin32.sourceforge.net/packages/unzip.htm
Either put the binaries in the same directory or put them somewhere else and set your windows PATH
I used my own ftp to test most of this. Your ftp was offline for me, so it might take some tweaking but this should put you in the right direction.

how to copy whole directories using FTP commands

Anyone know how to put whole directories from local to another server using FTP command?
i had use mput , but it just transfer file only.
cd /images_temp --> ws_ftp virtual folder name
mput *.IMG --> just transfer multiple file
anyone can teach me what command i need to use to transfer whole directories?
thanks
You can use mput * or mget *. Confirm with a rather than y. You can change the prompting behavior using the prompt command. You will find more information in the manual page. In a unix environment, man ftp
You can iterate and decent into directories and use mput *.IMG but that would probably inefficient. Consider using ncftpput where you can upload the directory remotely with just one line.

WGET only the file names in an FTP directory

I am attempting to create a dynamic list of files available in an ftp directory. I assume wget can help with this but I'm not really sure how...so my question is:
What is the syntax for retrieving file names from an ftp directory using wget?
Just execute
wget --no-remove-listing ftp://myftpserver/ftpdirectory/
This will generate two files: .listing (this is what you are looking for) and index.html which is the html version of the listing file.

Resources