Is their Automatic command to send a JPG file using FTP
Dan Nelson
dnelson at allantgroup.com
Thu Jan 28 22:41:41 UTC 2010
In the last episode (Jan 28), Dixit, Viraj said:
> The script that I have setup does not work if I run the .netrc file. I
> ran the commands in ftp -v mode and it did not like machine command, did
> not like passwd or pwd etc.
The commands in .netrc are not the same ones that you send on the ftp
commandline (except for the macdef block), so that's to be expected. I just
tried your sample netrc file (with changes to match my system) and it worked
just fine:
(dan at dan.19) /tmp> cat ~/.netrc
machine 127.0.0.1
login dan
password xxxxxx
macdef init
binary
lcd /tmp
cd /
get COPYRIGHT
quit
(dan at dan.19) /tmp> ftp 127.0.0.1
Connected to 127.0.0.1.
220 studio FTP server (Version 6.00LS) ready.
331 Password required for dan.
230 User dan logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
binary
200 Type set to I.
lcd /tmp
Local directory now: /tmp
cd /
250 CWD command successful.
get COPYRIGHT
local: COPYRIGHT remote: COPYRIGHT
229 Entering Extended Passive Mode (|||62084|)
150 Opening BINARY mode data connection for 'COPYRIGHT' (6191 bytes).
100% |*************************************| 6191 11.48 MB/s 00:00 ETA
226 Transfer complete.
6191 bytes received in 00:00 (6.32 MB/s)
quit
221 Goodbye.
(dan at dan.19) /tmp> ls -l /COPYRIGHT COPYRIGHT
-r--r--r-- 1 root wheel 6191 Jan 13 11:14 /COPYRIGHT
-rw-r--r-- 1 dan wheel 6191 Jan 13 11:14 COPYRIGHT
If all you really want to do is download a single file from a remote server,
you can give ftp a url-style commandline argument and it will log in and
download the file automatically:
http://www.freebsd.org/cgi/man.cgi?query=ftp#AUTO-FETCHING_FILES
(dan at dan.19) /tmp> ftp ftp://dan:xxxxx@127.0.0.1/%2fCOPYRIGHT
Connected to 127.0.0.1.
220 studio FTP server (Version 6.00LS) ready.
331 Password required for dan.
230 User dan logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
200 Type set to I.
local: COPYRIGHT remote: /COPYRIGHT
229 Entering Extended Passive Mode (|||57935|)
150 Opening BINARY mode data connection for '/COPYRIGHT' (6191 bytes).
100% |*************************************| 6191 4.42 MB/s 00:00 ETA
226 Transfer complete.
6191 bytes received in 00:00 (2.52 MB/s)
221 Goodbye.
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list