yostupload
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 (.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
-d
to download instead.Or: use
-l
tossh
to the server. The remote shell’s current directory will correspond to path.Or: use
-R
to output rootFile path.Or: use
-u
to output the URL for path.Or: use
-i
to quickly set up the current directory for use withyostupload
.
The-i
option usage creates a.YostUploadRoot
file in the current directory so that from then on you can useyostupload
there. Append--no-progress
and/or--no-partial
if 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.
yostupload
uploads (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
”.yostupload
executes 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:
protocol
can bersync
,ftp
, orsftp
, or omitted (default isrsync
).command
is optional and defaults to the protocol name.host
is a domain name or IP address with no port appended; or, ifprotocol
isrsync
,host
may be omitted for uploading to a folder on the same host.url
is optional; defaults tohttp://$host
; used only by the-u
option.port
is optional.dir
is the path on the server; default is your home directory.rsync-args
,rsync-args-up
, andrsync-args-down
are optional; if present, these arguments are passed torsync
for up/download after the standard upload args-rRhHLtp
or download args-rRhHtp
. Don't use--rsh
here.finishUp
is 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
Use
rsync
if possible;ftp
andsftp
copy with world-readable permissions, and they aren't smart (likersync
is) about transferring only what needs to be transferred. Thersync
command 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;yostupload
warns if some permissions are too restrictive for web access.The
-v
option shows thersync
,ftp
, orsftp
transfer command actually used and puts the transfer command itself into verbose mode.The
-q
option refrains from warning about files with restricted permissions.The
-n
option sets-v
and refrains from actually running the command.The
-r
rootFile
option specifies a different root filename instead of “.YostUploadRoot
”.The
-o
dir
option 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