1

I had a directory of files that I compressed using:

tar -cvJf my_directory.xz my_directory

Now I've gone to decompress it using:

xz -dv my_directory.xz my_directory

and the resulting file is simply my_directory. It has no extension and it's not a directory, but the size corresponds exactly with what the original directory should be in its decompressed state.

-rw-rw-r-- 1 user computer 1.1G Jun  8 12:16 my_directory

What did I do wrong, and is there a way to remedy this if I no longer have access to the original uncompressed directory?

lusk
  • 125

2 Answers2

1

Another solution would be to just revert the actions with:

  1. xz -zv my_directory my_directory.xz (-z compress flag instead of -d decompress)
  2. tar -xvJf my_directory.xz (-x extract flag instead of -c create)

Which is something to always keep in mind as a possibility in terms of reversible operations such as compression.

What happened wrong here and why did tar -xf my_directory work?

Basically, xz -d simply decompressed the .tar.xz archive that you made, but still left it as a tarball .tar archive called my_directory without the extension as instructed.

You could have also renamed the file to anything.tar and then it would open correctly in the GUI.

Destroy666
  • 12,350
0

It turns out simply running tar -xf my_directory on the "decompressed file" successfully decompresses it into the original my_directory/ directory.

lusk
  • 125