spiderplant0
spiderplant0

Reputation: 3952

How do I use pax to extract to a specific directory

I am currently using tar to extract files...

tail -n+$ARCHIVE_START_LINE $archiveFilename | tar -xzm -C /

I need to use pax instead of tar, so something like ...

tail -n+$ARCHIVE_START_LINE $archiveFilename | gzip -d | pax -r 

This extracts to the current directory. Is there a way to extract to a specific directory (root in my case)? (I have tried ... pax -r > / but that gave an error.)

Upvotes: 1

Views: 836

Answers (1)

nneonneo
nneonneo

Reputation: 179717

The simplest solution is just to wrap pax in a subshell:

tail -n+$ARCHIVE_START_LINE $archiveFilename | gzip -d | ( cd / ; pax -r )

Upvotes: 1

Related Questions