0

I'm creating a .tar.xz archive like this:

XZ_DEFAULTS="T$(nproc)" tar cvfJ "$archive" -C "$dir" .

It's creating this useless . directory when I try to open the archive:

How can I fix that?

1 Answer 1

1

This seems to work:

(shopt -s dotglob && cd "$dir" && XZ_DEFAULTS="--threads=0" tar cvfJ "$archive" *)

(Improved with Freddy's suggestion)

It's a little annoying because $archive has to be an absolute path or relative to $dir now and * doesn't generally include dot files, but I can work around that at least.

1
  • 1
    Enable dotglob if you use bash and want to include hidden files: (shopt -s dotglob; cd "$dir"; XZ_DEFAULTS="T$(nproc)" tar cvfJ "$archive" *) Commented Jun 15, 2020 at 1:29

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.