I mounted a disk at /data
. This is empty at the moment.
I need rsync
to perform mkdir -p
than mkdir
as the file I needs to be at at level 4 i.e. /data/dir_1/dir_2/dir_3/filename
when dir_1
, dir_2
and dir_3
doesn't exists.
If I create the needed sub-directories manually I am able to perform rsync using following command:
rsync -avz source_diretory/ /data/dir_1/dir_2/dir_3
But if I don't create the sub directories, this command throws an error:
mkdir: cannot create directory ‘/data/dir_1/dir_2/dir_3/’: No such file or directory
I tried Googling, reading rsync's man page, tried using -r
-R
but could not make it work.
Can rsync
perform something like mkdir -p
or is that out of its scope?