13
1
I have a zip archive. The unzip -l myarchive.zip
command gives this listing:
top/subtop/files/1.txt
top/subtop/files2/2.txt
etc
The root folders are top/subtop for all files. How to extract those files without the two top/subtop folders?
E.g. when I am in /home/myuser/public_html directory, files/1.txt
and files2/2.txt
shoud be extracted directly to that directory.
I tried unzip myarchive.zip top/subtop/*
but it created top/subtop directories anyway.
Note that it is possible to ignore all directories (simply placing all the files next to each other) with
unzip -j
. – Skylar Ittner – 2019-05-11T01:32:31.360Hmm, good to know. I asked this because a few days ago, when creating an archive, it was adding some paths from above, unintentionally. So there was a problem unzipping them because of the additional top paths. However, I can't repeat this today - today it's working ok, i.e. when in top/subtop directory and doing zip -r files.zip * it does not add the top/subtop path as prefix to files path. I think I do exactly the same command, but strangely, results are different, so it is not necessary to strip top directories when unzipping. – camcam – 2012-07-05T06:12:21.963