Solved

ftp files and folders nad subfolders

Posted on 2011-03-08
5
458 Views
Last Modified: 2012-05-11
Does anyone have a script or know how to login to an FTP site and download all files folders and subfolders?

thanks
0
Comment
Question by:SteveSext
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Scovndrel
ID: 35079728
http://support.microsoft.com/kb/96269

FTP is capable of using scripts (lists of commands from external files). The following example demonstrates a script that opens a connection to IP address 11.11.11.11, logs on to the host as a guest with the password "guest," uploads the File1 file, and then quits:

open 11.11.11.11
user
guest
guest
put file1
quit

You must use the -s option for FTP to read this file under Windows. If the previous script was in a file called Test.scr, you can start the script by typing:

ftp -s:test.scr

You can specify the host name in the command line and then use the script to process the login. For example, if you use the following command line

ftp -s:test.scr 11.11.11.11

the script file should read as follows:
user
guest
guest
put file1
quit

However, if the FTP host implements automatic login, this command will not work. To turn off automatic login, use the -n switch in the command line as follows:
ftp -n -s:test.scr 11.11.11.11
0
 

Author Comment

by:SteveSext
ID: 35080546
thanks for that, if the site contains multiple files and folders, do you know how to download everything without being prompted for 'y' ?
0
 
LVL 4

Expert Comment

by:Scovndrel
ID: 35080578
I believe you use the "mget" command, for "get multiple files", and the next line on the script under the mget is a "y" all by itself, on that line, no quotes. The y by itself is the way to answer any prompts that you know will require it.
0
 

Author Comment

by:SteveSext
ID: 35081097
How can I download all subfolders as well? I think mget gets files only?
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 35082363
There is no native support for recursive file transfers in the basic FTP clients that are typically available.  With some scripting, or ZIPing up the files before the xfer you can move entire folder structures.

My preference is to use an FTP client though that adds this capability, like NCFTPGET.  It's free and a single command line can pull an entire folder tree.  There are other solutions that can do this as well.

http://www.ncftp.com/ncftp/doc/ncftpget.html

~bp
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This is an explanation of a simple data model to help parse a JSON feed
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now