Author |
Message |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Mon 04 Jun 2007, 13:56 Post subject:
upload a file to a ftp server from command line [Solved] Subject description: trying to get ftpput to work |
|
Solution
sh-3.00# ftpput -v -u myusername -p mypassword webpages.charter.net / test.html
Problem (see above for solution)
I have been trying to use one of the busybox commands
to upload a file to a ftp server from a command line
(I can download OK)
this is my input
Code: | #ftpput -v -u username -p password -P 21 ftp.server.com test3 test3
|
and this is what I get
Code: | Connecting to ftp.server.com
ftpput: cmd (null)(null)
ftpput: cmd USER username
ftpput: cmd PASS password
ftpput: cmd TYPE I(null)
ftpput: cmd PASV(null)
ftpput: cmd CWD test3
ftpput: CWD error: Can't change directory to test3: No such file or directory |
a new busybox is available
http://www.busybox.net/
doing a forum search and google search others seem to have difficulties too
Is there some simple thing I am missing?
. . . any other way of uploading from command line perhaps using curl?
_________________ YinYana AI Buddhism
Last edited by Lobster on Thu 07 Jun 2007, 05:08; edited 1 time in total
|
Back to top
|
|
 |
alienjeff

Joined: 08 Jul 2006 Posts: 2291 Location: Winsted, CT - USA
|
Posted: Mon 04 Jun 2007, 16:34 Post subject:
|
|
I, too, have experienced frustration with the stripped-down and sometimes kludge-versions of apps within Busybox. This frustration is especially painful having used the "real" versions of such apps in full-sized *nix distros. There is relief to the ftp woes, Ed.
My own favorite ftp tool is lftp, a superb, full-featured cli ftp app strongly suggested to me by my guru-by-marriage, ubergeek nephew-in-law. Downloading the source and compiling went well, too. I now happily shun gftp like the plague and fiddle with scripts to automate lftp tasks.
Some related links:
an excellent lftp tutorial
lftp mail threads
To fully appreciate the power of lftp, patiently and methodically going through the tutorial linked above is advised. Set aside a wee bit of time as it's well worth it! To do otherwise, you'd be cheating yourself. lftp makes fast and efficient work of my own website maintenance.
-aj
_________________ hangout: ##b0rked on irc.freenode.net
diversion: http://alienjeff.net - visit The Fringe
quote: "The foundation of authority is based upon the consent of the people." - Thomas Hooker
|
Back to top
|
|
 |
HairyWill

Joined: 26 May 2006 Posts: 2946 Location: Southampton, UK
|
Posted: Mon 04 Jun 2007, 17:15 Post subject:
|
|
@Lobster
As you mentioned curl, yes there is a way using curl. Gekko posted curlftpfs, the second dotpup here
http://murga-linux.com/puppy/viewtopic.php?p=94776#94776
Just ignore all the GUI stuff he gives an example of a command to mount a remote ftp site as a local directory.
@AlienJeff
lftp looks very interesting I think I'll have to investigate that further.
_________________ Will
contribute: community website, screenshots, puplets, wiki, rss
|
Back to top
|
|
 |
trapster

Joined: 28 Nov 2005 Posts: 2106 Location: Maine, USA
|
Posted: Mon 04 Jun 2007, 17:46 Post subject:
|
|
I use curl with the following:
Code: | curl -T /filetouploadlocation/file.xxx ftp.wherever.com/directory/ -u user@website.com:password |
_________________ trapster
Maine, USA
Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
|
Back to top
|
|
 |
alienjeff

Joined: 08 Jul 2006 Posts: 2291 Location: Winsted, CT - USA
|
Posted: Mon 04 Jun 2007, 17:56 Post subject:
|
|
Just as an example of a typical lftp session here after making a new webpage on my desktop computer and wanting to update the remote server hosting my site:
Code: |
Hit F4 key (my personal hotkey to "open console")
cd /root/ghttpd/htdocs (get into the proper directory)
lftp mywebsite (calls simple mywebsite logon script)
mirror -Rn (compares local/remote dir contents, updates remote as necessary)
bye (closes lftp session)
|
This could (and will) be automated further when I write a simple bash script, but you get the idea.
June 15, 2007 edit: wove in directory change in above cli sequence to script file; to wit:
Code: |
F4
lftp mywebsite
mirror -Rn
bye
|
Now to figure out how to script the mirror command and "auto-bye" when mirror is completed. Off to O'Reilly's "Learning the bash shell" with the ultimate goal of hitting one hotkey to update the website.
-aj
_________________ hangout: ##b0rked on irc.freenode.net
diversion: http://alienjeff.net - visit The Fringe
quote: "The foundation of authority is based upon the consent of the people." - Thomas Hooker
Last edited by alienjeff on Fri 15 Jun 2007, 05:35; edited 2 times in total
|
Back to top
|
|
 |
trapster

Joined: 28 Nov 2005 Posts: 2106 Location: Maine, USA
|
Posted: Mon 04 Jun 2007, 18:02 Post subject:
|
|
I just tried the ftpput and it seems to work for me with:
Code: | sh-3.00# ftpput -v -u name@server.com -p password ftp.server.com /web/ stats
Connecting to ftp.nameofserver.com:21
ftpput: cmd (null)(null)
ftpput: cmd USER name@server.com
ftpput: cmd PASS password
ftpput: cmd TYPE I(null)
ftpput: cmd PASV(null)
ftpput: cmd CWD /web/
ftpput: cmd ALLO 1389(null)
ftpput: cmd STOR stats
ftpput: cmd (null)(null)
ftpput: cmd QUIT(null)
sh-3.00#
|
It seems you also need to tell it what directory you want to upload the file to
_________________ trapster
Maine, USA
Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
Last edited by trapster on Tue 05 Jun 2007, 09:54; edited 2 times in total
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Tue 05 Jun 2007, 00:53 Post subject:
|
|
Thanks guys already making progress (managed to upload a zero byte file) - well it is my idea of progress
these are the last few lines of code - and it is the last one that is opening the file(but not completing the transfer . . .
Code: | ftpput: cmd TYPE I(null)
ftpput: cmd PASV(null)
ftpput: cmd CWD /www/ap2/
ftpput: cmd ALLO 11882(null)
ftpput: cmd STOR test3
ftpput: cmd (null)(null) |
I am trying another server and persevere a little more with the busy box command. Maybe we need a newer version of BusyBox BUT that would be a major upgrade for Puppy I believe?
One potential of this command is to store configuration details with a Puppy server (for thoose without tin foil hats)
DSL I believe offer this option . . .
Update
OK I tried the Curl command on two servers (it seemed to be working) then it became slower and slower and failed
Again it created a 0 byte file on the server
_________________ YinYana AI Buddhism
Last edited by Lobster on Tue 05 Jun 2007, 05:21; edited 2 times in total
|
Back to top
|
|
 |
Gekko

Joined: 22 Jul 2006 Posts: 445 Location: Sydney, New South Wales
|
Posted: Tue 05 Jun 2007, 01:04 Post subject:
|
|
Why would you bother with something that obviously doesnt work? Just get lftp >_>. If you need me to package, I'll do that too. I also fail to see how this is "cutting edge."
|
Back to top
|
|
 |
Gekko

Joined: 22 Jul 2006 Posts: 445 Location: Sydney, New South Wales
|
Posted: Tue 05 Jun 2007, 03:34 Post subject:
|
|
http://www.murga-linux.com/puppy/viewtopic.php?p=120701
Theres your .pet Lobster, now you have no excuse.
|
Back to top
|
|
 |
kirk
Joined: 11 Nov 2005 Posts: 1518 Location: florida
|
Posted: Tue 05 Jun 2007, 20:47 Post subject:
|
|
I use wput to do that. Here's the man page:
http://wput.sourceforge.net/wput.1.html
And I'll attach a binary.
Description |
|

Download |
Filename |
wput.gz |
Filesize |
31.93 KB |
Downloaded |
373 Time(s) |
|
Back to top
|
|
 |
alienjeff

Joined: 08 Jul 2006 Posts: 2291 Location: Winsted, CT - USA
|
Posted: Tue 05 Jun 2007, 22:29 Post subject:
|
|
Just on a whim, I tried ftpput and after arguing with either ftpput or charter.net's syntax, a successful transfer was made. Here's the syntax I used:
Code: | sh-3.00# ftpput -v -u myusername -p mypassword webpages.charter.net / test.html |
Makes me appreciate lftp that much more.
</shameless_plug>
-aj
_________________ hangout: ##b0rked on irc.freenode.net
diversion: http://alienjeff.net - visit The Fringe
quote: "The foundation of authority is based upon the consent of the people." - Thomas Hooker
|
Back to top
|
|
 |
Gekko

Joined: 22 Jul 2006 Posts: 445 Location: Sydney, New South Wales
|
Posted: Tue 05 Jun 2007, 22:37 Post subject:
|
|
Wow, that sucks.
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Tue 05 Jun 2007, 22:52 Post subject:
|
|
thanks guys
thanks Kirk for that small util
got wput working using this info
http://en.wikipedia.org/wiki/Wput#Examples
I have looked at wput before - this time it worked
it seemed to hang about - may now look at the options to force a quick shutdown
_________________ YinYana AI Buddhism
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Thu 07 Jun 2007, 08:37 Post subject:
|
|
OK that works
Quote: | ftpput -v -u myusername -p mypassword webpages.charter.net / test.html |
. . . and it was fast and used Puppys existing code
(so it is my preferred solution)
_________________ YinYana AI Buddhism
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6541 Location: Valåmoen, Norway
|
Posted: Sat 09 Jun 2007, 07:30 Post subject:
|
|
Does ftpput allows to transfer a directory with its files, or is it restricted to only work with one file?
|
Back to top
|
|
 |
|