0

pwd:

/home/xxx 

File present in:

/home/a/b/c/d/e/

Here I want to tar a directory "e" in pwd (i.e xxx folder).

I tried like this

tar -vcf tarfile.tar /home/a/b/c/d/e/

But the problem is it compressing all the directories like (/home/a/b/c/d/e). But I need directory "e" should be compressed.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255

1 Answers1

1

To skip the parent folders, use the -C flag to change tar's working directory.

$ tar -C /home/a/b/c/d/ -vcf tarfile.tar e