FTP Files From Linux With Bash

View previous topic View next topic Go down

FTP Files From Linux With Bash

Post by jamied_uk on 25th November 2016, 20:32





Code:
#!/bin/bash
HOST='ftp@host.com'
USER='username'
PASSWD="pass"
FILE='test.mp4'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
exit 0
# sudo chmod +x ftp.sh
# ./ftp.sh
#
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: FTP Files From Linux With Bash

Post by jamied_uk on 25th November 2016, 22:11

Python




Code:
import ftplib
ftp=ftplib.FTP()

session = ftplib.FTP('host','user',"password")
file = open('test.txt','rb')                  # file to send
session.storbinary('STOR test.txt', file)     # send the file
file.close()                                    # close file and FTP
session.quit()

Code:
python ftp_python.py
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: FTP Files From Linux With Bash

Post by rivo on 16th February 2017, 11:12

Hi,

I was using this script to run on linuxmint 17. but I got ftp command not found.
ftp were installed,

any help ?

Thanks
Rivo

rivo

Posts : 1
Join date : 2017-02-16

Back to top Go down

Re: FTP Files From Linux With Bash

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum