How to copy only directory structure

For example you have defined directory structure with a lot of files. And task to copy only directory structure without files.

So, How to copy only directory structure ?

Let’s copy directory tree from old_tree to new_tree:

Results:

 

Author: GergunD

Comments

  1. Your command does not copy permissions of the directory tree. Try something like:
    sudo su
    cd old_tree/
    find . -type d -print0 | tar cpf /tmp/tmptree.tar –null –files-from – –no-recursion
    cd new_tree/
    tar xvf /tmp/tmptree.tar

Leave a Reply