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