I want to unzip the entire content of a zip file to the root of my server.
However each time i try to do this it creates a folder name for the file.
The zip file is called src.zip
the file is at the root of my site.
i used the following command
unzip src.zipThis unzips it but then create a folder called src and places the content there.
I want all of the content to be in the root of site and not in the folder.
11 Answer
Zip files don't store absolute paths. Below is from the zip spec, APPNOTE.TXT
4.4.17.1 The name of the file, with optional relative path. The path stored MUST NOT contain a drive or device letter, or a leading slash. All slashes MUST be forward slashes '/' as opposed to backwards slashes '\' for compatibility with Amiga and UNIX file systems etc. If input came from standard input, there is no file name field. To get the zipfile to extract to a specific location, use the -d option. This will extract the contents of the zip to the directory specified.
Like so
unzip -d / src.zip