Since you know the zip file contains an unwanted top-level folder, and since you know the name of that top level folder, you can use a symlink to cause all the contents of that folder to appear in the parent like so:
ln -s . 'data/All CRGs'
unzip 'All CRGs.zip' -d data
The ln
step causes the folder data/All CRGs
to be created, linking to the current directory (relative to data/
), which is data/
. Then, when you extract files from All CRGs.zip
and the unzip
command tries to create data/All CRGs/file.dat
, that file will get created as data/./file.dat
.
This technique can be demonstrated without a zip file using touch:
$ mkdir data
$ ln -s . data/subdir
$ touch data/subdir/foo.txt
$ ls data
foo.txt subdir
You can use this trick too to cause certain files or folders to be extracted to an alternate folder:
ln -s /tmp data/subdir2
Then anything in the archive being extracted to subdir2
will appear in /tmp
.
data/
to simplydata
and it will fix the issue.