Maybe this is the pinnacle of first world problems, but after years of angst I just have to air this.
Let's say you have downloaded funtool.zip
in your ~/Downloads
folder. You have two choices, each with two possible outcomes, depending on whether the archive has a proper root folder.
unzip funtool
. Possible outcomes:
~/Downloads/funtool/(files)
-- Good~/Downloads/(lots of files)
-- AUGH! Download folder littered
unzip funtool -d funtool
. Possible outcomes:
~/Downloads/funtool/funtool/(files)
-- Double folders. Annoying!~/Downloads/funtool/(files)
-- Good
I've seen some GUI decompressors have built-in intelligence for this, but I'm a CLI guy. My solution is to check for a root folder by unzip -t funtool
and act accordingly. But after years, I've had it.
Is there a script or something that does this automatically, even for rar
files, and possibly 7z
? At least this is one thing that tar
seems to get right every time, maybe because of good conventions.