Skip to content
Snippets Groups Projects
Commit cb582adc authored by Per Cederqvist's avatar Per Cederqvist
Browse files

New file. This should be automatically generated from ftp.pyex, but

for now it is written manually.
parent 46434163
No related branches found
No related tags found
No related merge requests found
# The mandatory ftp example...
import pcl_expect
pcl_expect.stty_init = "-onlcr -ocrnl"
ftp = pcl_expect.spawn("ftp ftp.funet.fi")
x = pcl_expect.impl()
while x.loop():
if x.re(ftp, "Name.*:"):
ftp.send("anonymous\n")
x.cont()
continue
elif x.re(ftp, "Password:"):
ftp.send("ceder@lysator.liu.se\n")
x.cont()
continue
elif x.re(ftp, "ftp> "):
pass
ftp.send("cd pub\n")
x = pcl_expect.impl()
while x.loop():
if x.re(ftp, "(?s).*ftp> "):
pass
ftp.send("passive\n")
x = pcl_expect.impl()
while x.loop():
if x.re(ftp, "(?s).*ftp> "):
pass
ftp.send("dir\n")
x = pcl_expect.impl()
while x.loop():
if x.re(ftp, "(?s).*ftp> "):
print ftp.match.group()
ftp.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment