an extremely easy-to-use command-line program
to upload or download files to/from a server
using options stored in a hidden file at the root of the local hierarchy.
You can run
yostupload in any directory within your local copy of your web site. It will look recursively toward root until it finds a configuration file (
yostupload knows your location within the local hierarchy, knows your upload preferences, and knows how to get to your server, so you don't have to specify a bunch of command arguments to get the job done.
ftp to do the transfers. Also, you can use
yostupload -l to
ssh directly to the corresponding folder on the server.
1 Z% cd ~/website/computers 2 Z% yostupload -v mvredir mkredir [ cd '/Users/neddie/website/' ] [ rsync --rsh 'ssh -l neddie' -rRhHLtp --bwlimit=3 --partial --progress computers/mvredir computers/mkredir DreamHost.com:public_html ] building file list ... done computers/ computers/mkredir/ computers/mkredir/index.html computers/mvredir/ computers/mvredir/index.html sent 24.43K bytes received 64 bytes 5.34K bytes/sec total size is 24.43K speedup is 0.99 3 Z% yostupload -lv yostupload: examining current directory [ ssh -t -l neddie DreamHost.com "cd 'public_html'/'computers' && exec $0 -l" ] server 1 Z% pwd /home/neddie/public_html/computers server 2 Z% exit Connection to DreamHost.com closed. 4 Z% yostupload -u mkredir/index.html http://yourhost.com/computers/mkredir/index.html 5 Z% yostupload -R /Users/neddie/website/.YostUploadRoot 6 Z%
yostupload [ -d [ -o dir ] ] [ -v ] [ -q ] [ -n ] [ -r rootFile ] \
[ --rsync-args args ] [ path ... ]
yostupload -l [ -r rootFile ] [ path ]
yostupload -R [ -r rootFile ] [ path ]
yostupload -u [ -r rootFile ] [ path ]
yostupload -i user host remote-dir [ rsync-args ]
path defaults to the current directory.
Uploads files unless
-dto download instead.
sshto the server. The remote shell’s current directory will correspond to path.
-Rto output rootFile path.
-uto output the URL for path.
-ito quickly set up the current directory for use with
-ioption usage creates a
.YostUploadRootfile in the current directory so that from then on you can use
--no-partialif you don't like the defaults.
All path arguments (files and/or folders) must be within a folder hierarchy that serves as a local staging area for a folder on the server.
yostuploaduploads (or downloads) everything between their corresponding locations in the local folder hierarchy and the server folder hierarchy.
The root of the local folder hierarchy is identified by the fact that it contains a parameters file called “
yostuploadexecutes this file and expects it to output key-value pairs, as in this example output:
protocol rsync command /usr/local/bin/rsync host upload.yourhost.com url https://somedomain.com/ port 12345 user neddie dir public_html rsync-args-up --bwlimit=48 --partial finishUp echo Upload succeeded $(date)
.YostUploadRoot” is executed, it can run another script containing favorite defaults, as this example does. Values from multiple lines with the same key are catenated.
Notes on the settings:
sftp, or omitted (default is
commandis optional and defaults to the protocol name.
hostis a domain name or IP address with no port appended; or, if
hostmay be omitted for uploading to a folder on the same host.
urlis optional; defaults to
http://$host; used only by the
diris the path on the server; default is your home directory.
rsync-args-downare optional; if present, these arguments are passed to
rsyncfor up/download after the standard upload args
-rRhHLtpor download args
-rRhHtp. Don't use
finishUpis a command to be run via ssh on host after a successful rsync upload. For example, after uploading crontab, this installs that crontab file on host and reports back the result:
finishUp crontab crontab ; crontab -l
sftpcopy with world-readable permissions, and they aren't smart (like
rsyncis) about transferring only what needs to be transferred. The
rsynccommand sets permissions on the server to match those in the local hierarchy, so when the destination is a public web site, local dirs should be searchable by all and local files should be readable by all;
yostuploadwarns if some permissions are too restrictive for web access.
-voption shows the
sftptransfer command actually used and puts the transfer command itself into verbose mode.
-qoption refrains from warning about files with restricted permissions.
-vand refrains from actually running the command.
rootFileoption specifies a different root filename instead of “
diroption argument is used as the destination directory for a download.
Yostupload works best with
rsync, a shell command found on linux, BSD, Mac OS X, etc. For one thing,
rsync transfers only things that have changed. For another thing, it uses a secure protocol, yet you can arrange things so you don’t have to enter your password every timethis works without storing the password in a local file. If your web hosting service is doesn’t support
rsync for uploads and downloads, you might want to consider switching to DreamHost, which does.
Here’s a sample
#!/bin/sh echo host yourhost.com echo user neddie echo dir public_html echo rsync-args-up --bwlimit=3
-u; fixed bug with remote
-foption renamed to
-dwill download multiple files