Solved

ftp files and folders nad subfolders

Posted on 2011-03-08
5
462 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 53

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
This is about my first experience with programming Arduino.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

840 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