Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unzip archive to an existing directory structure

I'm looking at bring the content of one WP blog over to another as I will be using WPML to server regional content instead of multiple sites. So not strictly a WP question, more command line.

This may seem an obvious or stupid question, but if I bring over the other 'uploads' folder as a zip and unzip to the wp-content folder, will the contents merge into the existing folders or overwrite what is already there.

If it's the latter, is there a switch I can append to ensure files are merged?

Thanks in advance, Tom

like image 654
tom Avatar asked May 01 '14 09:05

tom


People also ask

How do I unzip a file without a new folder?

My version of unzip has a -j option to not create any directory. Will extract all the files into the current directory without restoring the directory structure stored in the zip file.

How do I unzip a folder in archive?

To unzip a single file or folder, open the zipped folder, then drag the file or folder from the zipped folder to a new location. To unzip all the contents of the zipped folder, press and hold (or right-click) the folder, select Extract All, and then follow the instructions.

How do I unzip an archive file in Linux?

To unzip files, open File Manager, as explained in the Zipping Files via GUI section. Right click the ZIP package you'd like to extract, and select Extract Here, as shown below. Once you click Extract Here, Linux will extract all files in the ZIP package in the working directory.


1 Answers

When unzip finds a file that already exists in the destination, it will ask you if you want to overwrite it. You can then type y to overwrite it, A to overwrite all files, N if you don't want to overwrite any of them etc.

Example:

$ unzip archive.zip
Archive:  archive.zip
replace foo? [y]es, [n]o, [A]ll, [N]one, [r]ename:
like image 123
dogbane Avatar answered Oct 14 '22 21:10

dogbane