I posted about this on the KDE community a couple of weeks ago, but Dolphin (their file manager) has a nice trick for archives (zips, tar's, etc) - in the extract menu, there's an "Extract, Autodetect Subfolder" button which will:
If the archive has an inner subfolder (and just that), it will extract this as expected
If the archive doesn't have an inner subfolder, and all the files are at the root level, it will create a new folder for you and extract the files there
This way, you don't end up with files splattered all over say, your downloads folder. Easily one of my favorite features, and is something I wish every File Manager had. It feels like someone had the same pain that I do (and I'm sure plenty others) of extracting something, and regretting it - but then they went as far as to fix the problem for everyone and implemented a feature for it (I'd love to have the knowledge to contribute to KDE someday)!
A script to do that would also be nice for us cli junkies
As a fellow cli junkie, I made my own script like this years ago. But I got rid of it as part of debloating my system. Whenever I want to extract something, I create a directory and move the archive there.
I posted about this on the KDE community a couple of weeks ago, but Dolphin (their file manager) has a nice trick for archives (zips, tar's, etc) - in the extract menu, there's an "Extract, Autodetect Subfolder" button which will:
This way, you don't end up with files splattered all over say, your downloads folder. Easily one of my favorite features, and is something I wish every File Manager had. It feels like someone had the same pain that I do (and I'm sure plenty others) of extracting something, and regretting it - but then they went as far as to fix the problem for everyone and implemented a feature for it (I'd love to have the knowledge to contribute to KDE someday)!
A script to do that would also be nice for us cli junkies
As a fellow cli junkie, I made my own script like this years ago. But I got rid of it as part of debloating my system. Whenever I want to extract something, I create a directory and move the archive there.
Actually, someone in that thread pointed me to https://www.nongnu.org/atool this, which does exactly that!
7z x yourfile -odirectory