diff --git a/noblogsmv/main.py b/noblogsmv/main.py index 514cc3f9156191036804208de50bed47f3cbd00f..81b023c167e115f484d0d5ff92150cec4f7b1bd8 100644 --- a/noblogsmv/main.py +++ b/noblogsmv/main.py @@ -93,9 +93,11 @@ def process_move_data(blog_id, value, progress): blog_dir = os.path.join(BLOGS_DIR, blog_id) if not dry_run: + # Only run rsync if the directory actually exists. cmd = sshcmd( - 'root@%s' % value['old_host'], 'rsync', '-az', - '%s/' % blog_dir, 'root@%s:%s' % (value['new_host'], blog_dir)) + 'root@%s' % value['old_host'], + 'test ! -d %s || rsync -a %s/ root@%s:%s/' % ( + blog_dir, blog_dir, value['new_host'], blog_dir)) log.debug('Calling %s', ' '.join(cmd)) try: execute(cmd)