LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   FTP Upload Scripts Using lftp (http://www.linuxquestions.org/questions/linux-general-1/ftp-upload-scripts-using-lftp-724217/)

pricejm 05-06-2009 03:03 PM

FTP Upload Scripts Using lftp
 
3 Attachment(s)
I just finished making some upload scripts to facilitate some command-line uploading. I send many files to the same ftp server over and over and just wanted to make things a little more streamline. I wanted to just sends some files or directories up at a slow upload and have an email sent to me when it's done, whether hours, days, or weeks later.

Requires:
- lftp a rather wonderful command-line ftp client. I was searching for a command-line ftp client that would throttle uploads and I found this and have been using it ever since. It also has a mirror command that will mirror from local (upload) or mirror a remote directory. This is extremely useful when uploading directories with sub directories and files, since you would have to make any directories on the remote site if they did not exist (uploading). Plus probably useful for backup purposes since it can delete files on the remote if no longer on the local site.
- script uses "mail" as the sender; you may need to configure that portion of the script if you have another smtp client.

You will need to edit the configuration section in the script you wish to use with your email, and ftp info...

Anyways, hope it helps or can just be a reference for your bash scripting delight :)

Files:
> uploadFiles(.txt)
- usage: uploadFiles uploadDirectory file [file]* [--email] [--limit-rate=rate]
* uploadDirectory: directory to upload files to, will not create if does not exist
* file [file]*: list of files separated by spaces
* --limitRate: set rate to upload max in B/s
* --email: emails $EMAIL_ADDRESS when upload is complete, see configuration section
- uploads the given files to the specified directory on the remote site

> mirrorLocal(.txt)
- usage: mirrorLocal localDirectory remoteDirectory [limitRate] --email
* localDirectory: the local directory to mirror on the remote site
* remoteDirectory: the remote directory name that will be a mirror of localDirectory, will create remoteDirectory if it does not exist
* limitRate: set rate to upload max in B/s
* --email: emails $EMAIL_ADDRESS when upload is complete, see configuration section
-uploads an uploadDirectory to remoteDirectory

> common.bash(.txt)
- an include file that should remain in the same directory as one of the scripts above

linenoise88 06-12-2009 08:08 AM

Is it just me? I can't access the scripts posted here. Trying to open it, but it says I can't access them. I'm able to make this post so I am logged in and activated. Maybe a post of the file contents instead of an attachment would work.

Sam

MungoH 08-17-2009 10:00 AM

me too - although hopefully posting something enables permissions on my site account...

jmurga 01-11-2012 08:01 PM

sounds great the files but i really dont get how to use them sorry for my ignorance.

pricejm 01-12-2012 02:43 PM

Quote:

Originally Posted by linenoise88 (Post 3571670)
Is it just me? I can't access the scripts posted here. Trying to open it, but it says I can't access them. I'm able to make this post so I am logged in and activated. Maybe a post of the file contents instead of an attachment would work.

Sam

Probably would just make the thread too long if I posted the contents of the files.


jmurga, what sort of problems are you having?

aix_bloke 08-26-2012 03:32 PM

Thanks for posting
 
Thanks for this - it will be a good reference for me to automate the upload of a few files which get modified by another script. However they are spread over a fairly complex directory structure and they get listed in a text file. Manual uploading is a pain but this shows me how to create the FTP script file.


All times are GMT -5. The time now is 12:24 AM.