Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a script where I'd like to upload individual files and have the folder structure automatically generated like mkdir -p but I can't get rsync 2.6.9 (both) to cooperate.

It looks like rsync is making only one level of folders, otherwise erroring.

I'm trying to reproduce handy ncftpput -C -R -m remote-host local-path-name remote-path-name actions ( ncftp's Recursive mode; copy whole directory trees + Attempt to make the remote destination directory before copying.).


My Attempts:

rsync -av -e ssh /home/gitrepos/www/board/httpdocs/B/C/delete_snippet.processor.php


rsync: push_dir#3 "/var/www/vhosts/" failed: No such file or directory (2)

rsync -av -e ssh /home/gitrepos/www/board/httpdocs/B/C/delete_snippet.processor.php

works, creates httpdocs, but without the B/C structure.

rsync -advR -e ssh -v /home/gitrepos/www/board/httpdocs/B/C/delete_snippet.processor.php

works but recreates the entire /home/gitrepos... structure on the server.

permissions are set 777 and owned by user.

Thanks for help.

share|improve this question
up vote 2 down vote accepted

If you're using rsync 2.6.7 or later you can try the dot slash method after the httpdocs for limiting the directories. Try this:

rsync -advR -e ssh -v /home/gitrepos/www/board/httpdocs/./B/C/delete_snippet.processor.php
share|improve this answer
Hey it works! The internet version of the manual made it sound like that was 3.0+ feature and I didn't see it in my local manfile. I halfheartedly tried but wasn't sure which side it belonged on. Thank you. – thadk Oct 20 '10 at 18:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.