rsync throwing mkdir: cannot create directory ‘/data/dir_1/dir_2/dir_3/’: No such file or directory
rsync
command doesn't create directory tree, so you can do this by perform:
mkdir -p /data/dir_1/dir_2/dir_3
before rsync
command or use --rsync-path options:
--rsync-path=PROGRAM Use this to specify what program is to be run on the remote machine to start-up rsync.
Your command should be:
rsync -avz source_diretory/ --rsync-path="mkdir -p /data/dir_1/dir_2/dir_3 && rsync" /data/dir_1/dir_2/dir_3
Here is a useful link.