Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.).

Possible?

My Attempts:

rsync -av -e ssh /home/gitrepos/www/board/httpdocs/B/C/delete_snippet.processor.php user@testboard.org:/var/www/vhosts/testboard.org/httpdocs/B/C/delete_snippet.processor.php

returns:

rsync: push_dir#3 "/var/www/vhosts/testboard.org/httpdocs/B/C" failed: No such file or directory (2)

rsync -av -e ssh /home/gitrepos/www/board/httpdocs/B/C/delete_snippet.processor.php user@testboard.org:/var/www/vhosts/testboard.org/httpdocs/

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 user@testboard.org:/var/www/vhosts/testboard.org/httpdocs/

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

1 Answer 1

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 user@testboard.org:/var/www/vhosts/testboard.org/httpdocs/
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

 
discard

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.