Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want tar a direcory which contains a number of child directories. But here my requirement is to tar the entire parent direcory excuding one child directory.

Is there any command or procedure for this.

Thanks in advance.

share|improve this question

migrated from stackoverflow.com Apr 30 '13 at 8:06

This question came from our site for professional and enthusiast programmers.

    
Tar exclude doesn't exclude why –  Abdullah Shoaib Apr 30 '13 at 5:36

3 Answers 3

maybe

tar -zcvf foo_out.tar.gz --eclude bar foo_dir/

this really belongs in another stackexchange forum.

(from mobile)

share|improve this answer

Say if the parent directory is called parent and the directory to be excluded is child, you can try the following:

find parent \( ! -wholename "*child*" \) | cpio -ov --format=ustar > outfile.tar
share|improve this answer

Try This One , this creates your tar with excluding some folders or files

tar -czf filename.tar.gz pathToParentFolder --exclude=pathToParentFolder/childrenFolder

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.