I have a script that is rsync'ing folders. but rsync is not creating the parent directory. --dry-run says folder is being created but when i remove --dry-run the script errors saying failed: No such file or directory.

rsync -hav --progress $image_source $image_destination;

Do I have to check the folder's existence first?

1 Answer 1


rsync will only create the final level of the directory hierarchy on the remote host if it's missing.

If you have multiple missing levels, you can precede it with a command like this:

$ ssh remote-host 'mkdir -p /data/static/maps/2019'

rsync will then be able to create the missing 05 level underneath that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .