PROGRAM
b2_ftp.py
import
ftplib
ftp
= ftplib.FTP('192.168.5.101')
filename
= raw_input("Enter the filename ")
ftp.retrbinary("RETR
"+filename,open(filename,"wb").write)
b2_scp.py
b2_scp.py
import os
opt=raw_input("1.BBB to Machine \n2.Machine to BBB")
#and then check the response...
if opt =="2":
#machine to bbb
ip=raw_input("Enter IP of remote host: ")
os.system("ssh exam10@"+ip+" ls /home/exam10/")
file=raw_input("Enter remote file to be downloaded :")
os.system("scp exam10@"+ip+":/home/exam10/"+file+" /root/")
print("file transfer complete")
else:
#BBB to machine
ip=raw_input("Enter IP of remote host: ")
dest=raw_input("Enter destination folder of file: ")
os.system("ls -l")
file=raw_input("Enter file to be sent: ")
os.system("scp /root/"+file+" exam10@"+ip+":/home/"+dest)
print("file transfer complete!!!")
OUTPUT
root@beaglebone:~#
vi ftp.py
root@beaglebone:~#
python ftp.py
drwsrwsrwx 2 0
0 4096 Mar 13 07:21
A1-Theory
drwxrwsrwx 2 1000
0 4096 Feb 07 04:55 A2-Theory
drwxrwsrwx 2 1000
0 4096 Jan 13 22:32
A3-theory
drwxrwsrwx 2 0
0 4096 Jan 22 23:15
A4-Theory
drwxrwsrwx 2 1000
0 4096 Feb 07 05:00
A5-theory
drwxrwsrwx
2 0 0 4096 Apr 01 09:27 A6
drwxrwsrwx 2 1000
0 4096 Feb 16 08:31
A6-theory
drwxrwxrwx 2 1001
0 4096 Mar 13 10:56 B1
drwxrwsrwx 2 1000
0 4096 Mar 10 05:51
B17-theory
drwxrwxrwx 4
1001 0 4096 Mar 13 06:17 B6
-rwxrwxrwx 1 0
0 45568 Dec 16 08:05
Group B and C -Pl-iv distribution.doc
drwxrwsrwx 2 1000
0 4096 Mar 25 08:23 Lab
manual
drwxrwxrwx 8 1001
0 4096 Feb 26 04:21 PL4
Assignments
-rwxrwxrwx 1 0
0 235950 Jun 17 2014 Syllabus TE Comp 2012Course.pdf
-rwxrwxrwx 1 0
0 41053 Feb 26 05:33
new.jpg
-rwxrwxrwx 1 1001
0 42496 Feb 26 04:17
pl-4 lab index.doc
-rwxrwxrwx 1 0
0 42496 Feb 10 12:26
pl-4 lab schedule.doc
drwxrwxr-x 2 1001
0 4096 Apr 01 09:49
pl-iv question bank
Enter
the filename new.jpg
root@beaglebone:~#
ls
\ a1.py b1.py beaglebone.py
ftp.py hi.py
image2.jpg lift.py new.jpg script.py s.py
tp.py
a11.py b1p.py B1.py fact.py gg.py
image1.jpg lift1.py l.py
p1.py sig.py
tpp.py tp.py~
root@beaglebone:~#
\
No comments:
Post a Comment