How can I extract a .bz2 files directly into an external hard drive?
I have a large .bz2 file of 18 gigabytes and there's no way it will extract on to my very small computer storage. So I got an external hard drive, copied the file to it, and pressed 'extract' expecting it to extract to the hard drive. About 1/4 the way through, it stopped because it ran out of space because it was expanding on my computer storage, not the drive's.
I then looked at this question and tried to extract it like so but it turns out .bz2 is not .zip (obviously) so when I tried putting this command in terminal:
unzip /Volumes/My\ Passport\ for\ Mac/lichess_db_standard_rated_2020-10.pgn.bz2 -d/Volumes/My\ Passport\ for\ Mac
it gave me the following error:
Archive: /Volumes/My Passport for Mac/lichess_db_standard_rated_2020-10.pgn.bz2
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /Volumes/My Passport for Mac/lichess_db_standard_rated_2020-10.pgn.bz2 or
/Volumes/My Passport for Mac/lichess_db_standard_rated_2020-10.pgn.bz2.zip, and cannot find /Volumes/My Passport for Mac/lichess_db_standard_rated_2020-10.pgn.bz2.ZIP, period.
How can I extract this .bz2 into a hard drive directly?
The Unarchiver is a great tool where mac os's own extractor comes in short. You can download the utility via official website.
Once installed just open the app via Spotlight search or something. The preferences windows will open.
Make sure to activate bzip2 file archive type.
When you head to Extraction section of the preferences, you can click the dropdown menu mentioned as "Extract archives to:" and select "Ask for a destination folder".
Then, when you try to extract anything, you can select the destination folder as desired.
I hope this utility solves the issue for you. Feel free to comment if anything goes wrong.
Cheers!
Update: In order to extract to an external drive, you have to create a new folder inside the storage unit for unarchiver getting write permissions to your hard-disk. Minor thing mentioned by question owner in comments down below.