Jump to content

Hey Guys,

 

I need some help creating a script to do ftp backups over the internet

 

1. Needs to be FTP/SFTP

2. Needs to be compressed

3. I put this here so the list looks more complete

 

I understand FTP isn't secure etc etc... I don't care. Ive been using winscp with task scheduler but i want to make just a straight up batch file so that it runs.

Some of my clients will go and uninstall programs on their servers cause they feel like it.

 

Any guidance is appreciated.

QUOTE/TAG ME WHEN RESPONDING

Please Spend As Much Time Writing Your Question As You Want Me To Spend Responding To It. Take Time & Explain

 

New TOS RUINED the meme that used to be below :( 

Link to comment
https://linustechtips.com/topic/930736-ftp-backup-script/
Share on other sites

Link to post
Share on other sites

You could start with some python:

import ftplib
session = ftplib.FTP('server.address.com','USERNAME','PASSWORD')
file = open('kitten.jpg','rb')                  # file to send
session.storbinary('STOR kitten.jpg', file)     # send the file
file.close()                                    # close file and FTP
session.quit()

(took this from stackoverflow)

 

from this it should be easy to add what you need.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
https://linustechtips.com/topic/930736-ftp-backup-script/#findComment-11379223
Share on other sites

Link to post
Share on other sites

4 hours ago, unijab said:

winscp...

 

Isnt this the linux section?

People use WinSCP to ssh transfer files ?

 

Jrock, you should look into rsync.  Depending on what you're doing it may make your life easier.

As for compression, you could just have your script, tarball/gzip your files into an archive first then transfer them over.

If you're just starting out and using bash, I would start with bash scripting.

And then have it run from cron.daily or crontab depending on your poison.

Link to comment
https://linustechtips.com/topic/930736-ftp-backup-script/#findComment-11380207
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×