LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-06-2009, 03:03 PM   #1
pricejm
LQ Newbie
 
Registered: Aug 2005
Location: Charleston, SC.
Posts: 17

Rep: Reputation: 0
Post FTP Upload Scripts Using lftp


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
Attached Files
File Type: txt uploadFiles.txt (3.9 KB, 222 views)
File Type: txt mirrorLocal.txt (2.9 KB, 124 views)
File Type: txt common.bash.txt (2.0 KB, 110 views)

Last edited by pricejm; 01-12-2012 at 02:45 PM. Reason: Attached files...
 
Old 06-12-2009, 08:08 AM   #2
linenoise88
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
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
 
Old 08-17-2009, 10:00 AM   #3
MungoH
LQ Newbie
 
Registered: Aug 2006
Distribution: debian
Posts: 2

Rep: Reputation: 0
me too - although hopefully posting something enables permissions on my site account...
 
Old 01-11-2012, 08:01 PM   #4
jmurga
LQ Newbie
 
Registered: Jan 2012
Posts: 1

Rep: Reputation: Disabled
sounds great the files but i really dont get how to use them sorry for my ignorance.
 
Old 01-12-2012, 02:43 PM   #5
pricejm
LQ Newbie
 
Registered: Aug 2005
Location: Charleston, SC.
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by linenoise88 View Post
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?
 
Old 08-26-2012, 03:32 PM   #6
aix_bloke
LQ Newbie
 
Registered: Jul 2004
Location: Spain
Posts: 5

Rep: Reputation: 0
Cool 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.
 
  


Reply

Tags
bash, ftp, lftp, script, upload


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
lftp upload sycamorex Linux - Networking 11 05-25-2013 02:22 PM
lftp to upload file pritisolanki Linux - Newbie 2 03-20-2009 07:59 AM
Is there an ftp program that allows for multi-thread ftp uploads ? Want faster upload brjoon1021 Linux - Software 4 02-04-2009 06:28 PM
Php upload createdir deldir set of scripts nx5000 Programming 3 12-11-2007 10:52 AM
FTP upload hinetvenkat Linux - Software 3 06-02-2005 09:34 PM


All times are GMT -5. The time now is 01:30 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration