brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: unzip -j extracts files without recreating the folders

Files
~/tips/tip-unzip-j-junk-paths

unzip -j archive.zip -d out/

Unpack the files of a zip flat into one directory, ignoring its folder structure

Some zip files bury a few files under several levels of folders, and you only want the files themselves.

Use -j, short for junk paths:

unzip -j archive.zip -d out/

Every file lands directly in out/, whatever folder it came from inside the archive. Name patterns work too. unzip -j photos.zip "*.jpg" -d pics/ pulls out only the JPEG files and drops them in one folder.

Before you extract, list the contents with unzip -l archive.zip so you know what to expect.

A caveat: if two files in different folders share a name, unzip asks before it overwrites one. Add -n to never overwrite, or -o to overwrite without asking, and in both cases you lose or skip one of the files. Check for duplicate names with the list first.

Further reading: Info-ZIP unzip man page

More Files tips sha256sum -c --ignore-missing SHA256SUMS xxhsum -H64 backup.tar > backup.xxh Files > More > Select > pick files > More > Compress ls -lhS /var/log file photo.jpg data.bin All Files tips (15) All topics

Link