need to careate archive od only the directory
I want to create an archive of directory structure. and I have tried to pipe the output of find command as fallows but it is not working
find ./123/ -type d | tar -cvf 123.tar Can some one tell me how to do this. All I need is the empty directories |
Why can't you just do:
Code:
tar cvf 123.tar * |
A few remarks:
1. Don't pass a directory and all it's subdirectories to "tar". If you give it the (top-level) directory to archive, then it'll go through all files/subdirectories recursively. So, in your case, you only need to do: Code:
tar -cvf 123.tar 123/ Code:
find 123 -type d -exec mkdir /new/path/{} \; |
You could create an identical directory structure in another directory and then tar that.
mkdir 123tardir find 123/ -type d -exec mkdir ../123tardir/'{}' \; cd 123tardir tar cvf ../123.tar . |
Hi Guys Thank you for you'r help. What I wanted was to take a empty directory structure to a another machine and create it there (directories only). I was able to do this by using
Create the directory tree 1) find . -type d -depth -print |cpio -ovcB > dir-tree.cpio Extract - Only Directory Tree 2) cpio -icvBdum < dir-tree.cpio Best regards Asanka |
All times are GMT -5. The time now is 10:34 PM. |