Tar only the Directory structure

后端 未结 5 1757
不知归路
不知归路 2021-02-13 13:26

I want to copy my directory structure excluding the files. Is there any option in the tar to ignore all files and copy only the Directories recursively.

5条回答
  •  迷失自我
    2021-02-13 14:02

    for i in `find . -type d`; do mkdir -p /tmp/tar_root/`echo $i|sed 's/\.\///'`; done
    pushd /tmp/tar_root
    tar cf tarfile.tar *
    popd
    # rm -fr /tmp/tar_root
    

提交回复
热议问题