0

Use this command to exclude sub-directories while compressing but it didn't work:

    tar -zcvf slice.tar.gz --exclude=slice/media* --exclude slice/images/doc/* slice

It still compresses all the sub-directors inside media and doc. What am i doing wrong?

Nikita Gupta
  • 827
  • 1
  • 7
  • 13
  • Possible duplicate: http://stackoverflow.com/questions/984204/shell-command-to-tar-directory-excluding-certain-files-folders – Ilya Mar 16 '15 at 11:32
  • Also it is better to delete not related tags from the question and add information about version of your `tar`. – Ilya Mar 16 '15 at 11:42

1 Answers1

1

Option '--exclude' must be at the beginning of the tar command. And do not forget quotation marks.

Try this: tar --exclude='slice/media*' --exclude='slice/images/doc/*' -zcvf slice.tar.gz slice

Ilya
  • 4,583
  • 4
  • 26
  • 51