To copy only the directory structures (without copying the files themselves) using rsync
, you can use the --dirs
option:
rsync -a --dirs /source/ /destination/
Here, -a
is used to preserve the permissions, ownership, timestamps, etc. of the directories. The --dirs
option tells rsync
to copy only the directories, and not their contents.
For example, if you have a directory tree like this:
/source/
dir1/
file1.txt
file2.txt
dir2/
file3.txt
file4.txt
Running the above rsync
command will result in the following directory tree at the destination:
/destination/
dir1/
dir2/
Note that the files within the directories are not copied. Only the directory structures are copied.