Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
6 total  XML / RSS feed 

Add missing empty directories in .svn

Fix errors like
svn: Your .svn/text-base directory may be missing or corrupt; run 'svn cleanup' and try again
svn: Can't open file 'blabla/.svn/text-base/entries': No such file or directory

require 'pathname'

def recurse(dir)
  for child in dir.children
    next unless              # ignore files
    next if child.basename.to_s == '.svn'     # ignore .svn directory
    next unless (child + '.svn').exist?       # ignore unadded directories
    text_base_dir = child + '.svn/text-base'  # path to text-base dir
    next if text_base_dir.exist?              # ignore existing text-base dirs
    puts text_base_dir
    recurse child


Complete backup of all domains to strongspace

# comprehensive TextDrive backup to Strongspace
# Joel Dueck (
# This script will backup all websites in your TextDrive account to Strongspace.
#         1. Save this script into your home dir,  chmod it to 700 for security
# 2. Create a pair of ssh keys; install the public key on your strongspace account and the private one in ~/.ssh
# 3. Change the configuration variables below

## Configuration section
#  [Don't forget trailing slashes for all directories!]


        # Optional: Enter the path in your TextDrive account where your database backups are stored.
        # If found, this directory will be rsync'd to strongspace separately. If this folder does not exist then 
        # this feature will be ignored.
        # For a cron job that will create daily rolling MySQL backups, see

        STRONGSPACE_KEY=/home/YOURUSERNAME/.ssh/ss             # Private key file
        STRONGSPACE_USER=SSUSER                                  # Your strongspace login name          # Your strongspace domain

        STRONGSPACE_WEB_BACKUP_DIR=private/backup/web/               # strongspace path for storing web file backups
        STRONGSPACE_DB_BACKUP_DIR=private/backup/databases/  # optional strongspace path for storing SQL backups
## End of configuration section

DOMAINS=`ls ~/domains`
for dom in $DOMAINS
        /usr/local/bin/rsync -azq --delete -e "ssh -i $STRONGSPACE_KEY" ~/domains/$dom/public_html/ $STRONGSPACE_USER@$STRONGSPACE_DOMAIN:/home/$STRONGSPACE_USER/$STRONGSPACE_WEB_BACKUP_DIR/$dom

if [ -d ~/public_html ]; then
        /usr/local/bin/rsync -azq --delete -e "ssh -i $STRONGSPACE_KEY" ~/public_html/ $STRONGSPACE_USER@$STRONGSPACE_DOMAIN:/home/$STRONGSPACE_USER/$STRONGSPACE_WEB_BACKUP_DIR/$dom

if [ -d $DB_BACKUP_DIR ]; then

rsync syntax

rsync -avz --eahfs --progress --delete /source-dir-without-trailing-slash /destination-dir-with-trailing-slash

// explanation of switches
// -a, archive mode, equivalent to -rlptgoD which does things like recurse through all the dirs, preserves times, etc.
// -v, verbose mode
// -z, compress - makes the copy go faster. doesn't actually compress into a zip file
// --eahfs - (could also use -E, I think)
// --progress - show copy status of each item
// --delete, delete files on destination that aren't on source (sync)

Rsyncing to StrongSpace

This is a handy script to synchronize a number of folders with StrongSpace (or any other server).


# `ss` is the alias for my StrongSpace login.
# `home/novemberborn/` is the directory in which I want to store stuff.
REMOTE = 'ss:/home/novemberborn/'

def rsync local_path, remote_dir
   puts `rsync -azv #{local_path} #{REMOTE}#{remote_dir}/`
   puts "\n---\n"

# rsync 'local_directory_path', 'remote_directory_name'
rsync '~/Documents/', 'Documents'

rsync for dummies

rsync -e ssh -av here/ there/

rsync via ssh

rsync -rvzp -e ssh --include=".htaccess" "[email protected]:/home/user/source" "/home/user/destination"
« Newer Snippets
Older Snippets »
6 total  XML / RSS feed