yostuploadan 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 (.YostUploadRoot). Now 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. yostupload uses rsync or ftp to do the transfers. Also, you can use yostupload -l to ssh directly to the corresponding folder on the server.
Example:
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%
Usage: 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.Or: use
-ltosshto the server. The remote shell’s current directory will correspond to path.Or: use
-Rto output rootFile path.Or: use
-uto output the URL for path.Or: use
-ito quickly set up the current directory for use withyostupload.
The-ioption usage creates a.YostUploadRootfile in the current directory so that from then on you can useyostuploadthere. Append--no-progressand/or--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 “
.YostUploadRoot”.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)Because “
.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:
protocolcan bersync,ftp, orsftp, or omitted (default isrsync).commandis optional and defaults to the protocol name.hostis a domain name or IP address with no port appended; or, ifprotocolisrsync,hostmay be omitted for uploading to a folder on the same host.urlis optional; defaults tohttp://$host; used only by the-uoption.portis optional.diris the path on the server; default is your home directory.rsync-args,rsync-args-up, andrsync-args-downare optional; if present, these arguments are passed torsyncfor up/download after the standard upload args-rRhHLtpor download args-rRhHtp. Don't use--rshhere.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 -lUse
rsyncif possible;ftpandsftpcopy with world-readable permissions, and they aren't smart (likersyncis) about transferring only what needs to be transferred. Thersynccommand 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.The
-voption shows thersync,ftp, orsftptransfer command actually used and puts the transfer command itself into verbose mode.The
-qoption refrains from warning about files with restricted permissions.The
-noption sets-vand refrains from actually running the command.The
-rrootFileoption specifies a different root filename instead of “.YostUploadRoot”.The
-odiroption 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 .YostUploadRoot file:
#!/bin/sh echo host yourhost.com echo user neddie echo dir public_html echo rsync-args-up --bwlimit=3
Here’s where to download
the yostupload program,
which is implemented as a zsh (Z-Shell) script.
--rsync-args work rsync only)
.YostUploadRoot file
-l option
-v option
.YostUploadRoot file
-r rootFile, finishUp, and port
-f
-u; fixed bug with remote cd used by -l and finishUp
cd used by -l and finishUp
-f option renamed to -R;
added -i, -o, -q options;
-d will download multiple files