How to tar/zip a parent directory exculding a child direcory

0

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.

Kishore Tamire

Posted 2013-04-30T05:32:09.660

Reputation:

Tar exclude doesn't exclude why – None – 2013-04-30T05:36:59.030

Answers

0

maybe

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

this really belongs in another stackexchange forum.

(from mobile)

donfede

Posted 2013-04-30T05:32:09.660

Reputation: 101

0

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

devnull

Posted 2013-04-30T05:32:09.660

Reputation: 2 987

0

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

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

Anubhav Singh

Posted 2013-04-30T05:32:09.660

Reputation: 101