linuxpax

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.)


Solution

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

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