FTP with Wget

I am finally making progress with FTP and Wget!

I am still having a couple of coding problems however.  Here are the two things that I need to accomplish, and if possible, I will need the exact code.  

I am able to download a file to my "C" drive using this code.

wget
ftp://smarty:pants@ftp.mysite.com/happy.txt --output-document= "c:\happy.txt

I need the exact code as to how to download all of the files in that directory.  If you could show me how using the same code I used above.   And how to get a .txt log or a list of all of the files in the directory, so I can import the list into my database or print it.

Please when you give the code, use my working code above and just add to it.

All of this must work with the command line.

Thank you so much!!
fmwebschoolAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tmkellerCommented:

you could try this:

wget -r -11 --no-parent -A.* ftp://smarty:pants@ftp.mysite.com/happy.txt --output-document= "c:\happy.txt


http://linux.about.com/od/commands/l/blcmdl1_wget.htm
0
jkrCommented:
Actually,

wget ftp://smarty:pants@ftp.mysite.com/*.*

should do that and save the files in your current directory.
0
fmwebschoolAuthor Commented:
Thanks guys, I will try this first thing in the morning and let you know how it turns out!  Thank you, will let you know first thing a.m. EST.

In Kindness
Stephen
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

fmwebschoolAuthor Commented:
Things are pretty close!  I am trying wget ftp://smarty:pants@ftp.mysite.com/*.* but that just drops the files all over my desktop.  I tried:

wget ftp://smarty:pants@ftp.mysite.com/*.*

I also tried

wget ftp://smarty:pants@ftp.mysite.com/*.* --output-document= "c:\ftp"  and this drops the files all over my desktop instead of into a folder on my "ftp" folder on my "C" drive.

I need to be able to drop all of the documents into the folder, and I need a string that enables me to grab the names of all of the files in a .txt document.

Thank you so much :)  I'm almost there, just deleting dozens of files off my desktop now :)
0
jkrCommented:
Pack that in a .bat file, e.g.

ftpgetall.bat
--------------------->8---------------------
cd %1
wget ftp://smarty:pants@ftp.mysite.com/*.*
--------------------->8---------------------

and call that like

ftpgetall c:\ftp
0
fmwebschoolAuthor Commented:
JKR, (Alias, my hero),

Thank you, I'm going to try it now :)  Thank you !
0
fmwebschoolAuthor Commented:
OK here is what I have and here is what happens!

I have a folder on my C: drive named "ftp"

I have created a bat file that looks like this, and saved it to my "C" drive

cd %1
wget ftp://smarty:pants@ftp.mysite.com/*.*

When I run ftpgetall c:\ftp from the command line, a window opens that says
ftp://ftpgetall/

The an FTP Folder Error opens and says:
"Windows cannot access this folder.  Make sure you typed the file name correctly and that you have permission to acces the folder.  Details:  The server name or address could not be resoved.  

It doesn't bring up the dos window, and it doesn't look like wget is even being executed.  I have wget in my windows folder as well as well as directly on my "C" drive in a folder called fmget.  This works,

"c:\fmget\wget.exe ftp://smarty:pants@ftp.mysite.com/*.*  but it dumps the files all over my desktop.  Is there some way I can just code that to just dump into my "ftp" folder on my "C" drive?

Thanks!!!
Stephen


0
jkrCommented:
Aer you calling it like

ftpgetall c:\ftp

?

Apart from that, you could 'hard code' a folder like

ftpgetall.bat
--------------------->8---------------------
cd c:\ftp
wget ftp://smarty:pants@ftp.mysite.com/*.*
--------------------->8---------------------
0
fmwebschoolAuthor Commented:
Hi JKR :),


Yes I am typing:

ftpgetall c:\ftp

And I have changed the .bat file to:

cd c:\ftp
wget ftp://smarty:pants@ftp.mysite.com/*.*


When I type "ftpgetall c:\ftp " into the command line, a screen immediatlely appears with:  ftp://ftpgetall/ in the address bar, and the same error message.

So, there is no way without the bat file that I can just add it to this string:
"c:\fmget\wget.exe ftp://smarty:pants@ftp.mysite.com/*.* 

and have it save the files to the corrext location?  something like --output c:\ftp?

Thanks for all your help!
Stephen


0
jkrCommented:
No, there's no option to specify an putput folder other than cd'ing to the folder you want to use.
0
fmwebschoolAuthor Commented:
I see :(  Sooooooo, if I wanted to try this without using the .bat file how would I write the string straight out without the .bat file?

cd c:\ftp "c:\fmget\ wget"  ftp://smarty:pants@ftp.mysite.com/*.*

???

Is that close?

Thanks Stephen
0
jkrCommented:
It won't work without a batch file, since the Windows command processor does not allow 'command chaining' as as UN*X shell does... Only one command per line, sorry.
0
fmwebschoolAuthor Commented:
JKR,

This is what I did, very strange but it downloaded all of the files into my "fmget" folder.  Here is my string

"c:\fmget\ wget.exe"  c:\ftp  ftp://smarty:pants@ftp.mysite.com/*.*


So if that will drop them into my "fmget" folder, how do you think I can rewrite it to drop them into my "ftp" folder instead?

Very close now :)  !!
0
jkrCommented:
I gave it a shot, and

--------------------->8---------------------
c:
cd c:\ftp
wget ftp://smarty:pants@ftp.mysite.com/*.*
--------------------->8---------------------

worked fine.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fmwebschoolAuthor Commented:
SMoooooooochhhhhh!   I'm not sure what it was, but I ran it that time and it worked perfectly.  I resaved the above as a .bat file and it ran :)

used C:\try.bat from the command line :)


Thank you so much for sticking with me on this!
Stephen
0
jkrCommented:
You're most welcome ;o)

(At least I found that no FTP server here allows anonymous login - also a nice side effect *g*)
0
fmwebschoolAuthor Commented:
Well :)  Two good things came out of this!  I'm going to continue work away, You know I'll be back with more questions, only half way through this article :)

Thanks again!
Stephen
0
fmwebschoolAuthor Commented:
JKR,

Guess what I figured it out without a .bat file.

I simply did this:

wget ftp://smarty:pants@ftp.mysite.com/*.* -P C:\ftp

Hope this is helpful!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.