LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-06-2014, 01:38 AM   #1
phew72
LQ Newbie
 
Registered: Jun 2014
Posts: 3

Rep: Reputation: Disabled
Unhappy Help needed to un-do a disastrous ZIP command


Hi all

I'm a novice Linux user and I'm in a bit of a jam.

I wanted to create a .zip archive of a website folder that I could download and archive. This is via command-line on an AWS server using Amazon Linux with ZIP installed.

So I CD'd into the WWW folder and ran the following command (which I found here):
  • zip archivefile1 *
What this did however was compress every individual file separately (inc. in sub-directories), overwriting the original with the .gz extension. Obviously the whole website is kaput as a result!

All the files are still there there though, but compressed. Is there any way to un-do or roll back this command and restore my website to life?

God, I hope so!
 
Old 06-06-2014, 01:59 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
yes, that is the unzip command.
 
Old 06-06-2014, 03:04 AM   #3
phew72
LQ Newbie
 
Registered: Jun 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for your reply pan64.

unzip is unpacking the 'archivefile1' zip file. The trouble is all the files in the www folder (and sub folders) were individually compressed before being collectively packed into one big zip file, and they've stayed that way.

So for example:
  • /index.php is now /index.php.gz
  • /img/logo.jpg is now /img/logo.php.gz
etc

And there are thousands of files!

Is there a way to somehow recursively unpack all these individual .gz files?

Last edited by phew72; 06-06-2014 at 03:06 AM.
 
Old 06-06-2014, 03:21 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
I do not understand it: zip archivefile1 * will create one file, named archivefile1.zip and you can use unzip archivefile1.zip to restore the original files. zip will not create .gz files. Probably you executed gzip *. In that case you can undo it by gunzip *
 
1 members found this post helpful.
Old 06-06-2014, 03:48 AM   #5
phew72
LQ Newbie
 
Registered: Jun 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Ah, gzip. Now you mention it, yes I may have done that :/

Thank you so much pan64. I feel a little stupid, but greatly relieved.

Last edited by phew72; 06-06-2014 at 04:10 AM.
 
Old 06-14-2014, 07:47 PM   #6
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 518
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Code:
find . -iname "*.gz" -exec gunzip {} \;
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to zip several files to several zip with one command? thomas2004ch Linux - Newbie 4 02-08-2010 08:13 AM
Disastrous upgrade to 11.2 from 11.1 Ragodin SUSE / openSUSE 4 02-04-2010 06:59 AM
File tzupdater-1_3_0-2007h.zip NEEDED!! HELP LinuxNewbie999 *BSD 3 04-13-2008 08:55 AM
Help needed: attaching zip file using mailto hmacasiano Linux - Newbie 9 10-06-2005 04:21 AM
Information needed: Zip 250 IDE cnjohnson *BSD 1 08-28-2003 01:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration