Quantcast
Channel: Unix zipping sub directory not including parent directory - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Unix zipping sub directory not including parent directory

$
0
0

I want to zip a sub directory and send it elsewhere, the problem I have is when I use the zip command it also includes all the unwanted layers of directories I do not want.

e.g.

zip -r /new.zip /Unwanted1/Unwanted2/wanted1/wanted2/file.txt

###unzipped produces the following
/Unwanted1/Unwanted2/wanted1/wanted2/file.txt

###I want
/wanted1/wanted2/file.txt

update: The directory I want to zip has lots of nested directories, hence the -r. Also it would be great to deal with absolute paths, the old solution used to cd about the place but I just didn't really like it. Perhaps that is the best (only) way.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images