LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 03-10-2012, 07:23 AM   #1
Sabinou
Member
 
Registered: Jan 2006
Location: France
Distribution: Debian Wheezy, Webmin + Virtualmin (remote dedi)
Posts: 214

Rep: Reputation: 30
Smile Simple syntax that I fail to make work, argh this is irritating. Any help please ? :)


Hello,

I have a folder with a few zip files whose contents I want to refresh with a new version of a certain file. The new version of the file for the update is already present in the same folder as the zips, all that's left is to find how to perform a "zip -fv" to all of the zip files.

And.... Aaaaaargh, i'm embarrassed, I don't manage to make it T_T

May I humbly ask for your help, please ?

Here are my attempts :

zip -fv *
zip diagnostic: new.txt up to date
(oops, no zip file has been processed, only the file for the update has been update-checked ?!?)

zip -fv *.zip
(and here, nothing happened, at all, despite the -v )

find . -type f -exec zip -fv
find: missing argument to `-exec'
(I was even going over the top with a "search for all files whatever" to make SURE the Zip files would be taken in the lot, and to hell with "only taking the Zip format files", that was OK since it was a folder only populated of zips and of one file to update with... But no, apparently, not good. And no more success with "zip -fv" between double quotes)

zip -fv '*.zip'
zip warning: *.zip not found or empty
(no harm in trying, right -_-)

zip * -fv
(no surprise : zip diagnostic: new.txt up to date, I'd have almost been offended if it had worked)

find . -type f -exec zip -fv \;
zip error: Invalid command arguments (cannot write zip file to terminal)
zip error: Invalid command arguments (cannot write zip file to terminal)
zip error: Invalid command arguments (cannot write zip file to terminal)
zip error: Invalid command arguments (cannot write zip file to terminal)
zip error: Invalid command arguments (cannot write zip file to terminal)
zip error: Invalid command arguments (cannot write zip file to terminal)
(I took inspiration from that page for the final \;, to almost promising results, it seems each file was attempted to, and failed for some reason)

And here I am, helpless, and slightly humiliated too

Man pages for Zip here, and a simpler version there.


Please, would you know how to do ? Thank you VERY MUCH if you can help !

Last edited by Sabinou; 03-10-2012 at 08:32 AM.
 
Old 03-10-2012, 10:24 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,550

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
Well your second option worked fine for me:
Code:
zip -fv *.zip
As long as all zip files (path to them of course) and the newly updated file are all in the same location as where they were when the zip was created.
 
Old 03-10-2012, 10:32 AM   #3
Sabinou
Member
 
Registered: Jan 2006
Location: France
Distribution: Debian Wheezy, Webmin + Virtualmin (remote dedi)
Posts: 214

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by grail View Post
Well your second option worked fine for me:
Code:
zip -fv *.zip
As long as all zip files (path to them of course) and the newly updated file are all in the same location as where they were when the zip was created.
It worked for you ?!?

$ls
1.zip 2.zip 3.zip 4.zip 5.zip new.txt


And all the zips contain new.txt in their root.

$ zip -fv *.zip
$


Aaaand... Nothing happened. No output.

That shouldn't be possible, the simple -f trigger means "parse all the files of the archive in search of one that can be updated", while the -v trigger means "print a result for each file in the archive for which Zip searches for an update".

Did something different happen to you, please ? O_o


UPDATE : for instance (there will be an "up to date" message, it's not my first test sorry, haha),

/test$ zip -fv 1.zip
zip diagnostic: new.txt up to date
zip diagnostic: notes and info.txt missing or early
zip diagnostic: stuff.doc missing or early
zip diagnostic: foldertest/ missing or early
zip diagnostic: foldertest/file1.pdf missing or early
zip diagnostic: foldertest/file2.jpg missing or early

Last edited by Sabinou; 03-10-2012 at 10:45 AM.
 
Old 03-10-2012, 12:13 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,550

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
Well here is what I did:
Code:
$ ls
d.awk  d.sh  f1  outfile  outfile2
$ zip test.zip *
  adding: d.awk (deflated 43%)
  adding: d.sh (deflated 41%)
  adding: f1 (deflated 43%)
  adding: outfile (deflated 59%)
  adding: outfile2 (deflated 59%)
$ ls
d.awk  d.sh  f1  outfile  outfile2  test.zip
$ touch f1
$ zip -fv *.zip
zip diagnostic: d.awk up to date
zip diagnostic: d.sh up to date
zip diagnostic: outfile up to date
zip diagnostic: outfile2 up to date
freshening: f1	(in=167) (out=96) (deflated 43%)
total bytes=1780, compressed=877 -> 51% savings
So is the issue maybe that the files and folders used to create the zip files are no longer available (in your example)??
 
Old 03-10-2012, 12:23 PM   #5
Sabinou
Member
 
Registered: Jan 2006
Location: France
Distribution: Debian Wheezy, Webmin + Virtualmin (remote dedi)
Posts: 214

Original Poster
Rep: Reputation: 30
hmmm, could it be that it worked just because there was only ONE zip in your directory ?

(and did the "touch f1" change that file so that the archive had to be refreshed with it ?!?)
 
Old 03-10-2012, 01:21 PM   #6
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,550

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
Yes it does appear it does not like to perform the task on multiple globbed files. I would suggest using a simple for loop or find:
Code:
find . -name '*.zip' -exec zip -fv {} \;
 
Old 03-10-2012, 01:45 PM   #7
Sabinou
Member
 
Registered: Jan 2006
Location: France
Distribution: Debian Wheezy, Webmin + Virtualmin (remote dedi)
Posts: 214

Original Poster
Rep: Reputation: 30
@Grail, thanks !

I had tried that, but without the {}, please, what does this {} actually mean ? Sorry to ask something obviously obvious

I'll test it in a pair of hours, I don't have my work PC right now.
 
Old 03-11-2012, 12:44 AM   #8
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,550

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
The {} is the variable that find uses to store what it has found and allows you to iterate over them one at a time.
 
1 members found this post helpful.
Old 04-26-2012, 05:16 PM   #9
Sabinou
Member
 
Registered: Jan 2006
Location: France
Distribution: Debian Wheezy, Webmin + Virtualmin (remote dedi)
Posts: 214

Original Poster
Rep: Reputation: 30
I'm back with a tiiiiiiiiiiiiiny delay : thank you very much Grail, it worked, and now I learned something more
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] bash script syntax fail as root goncalopp Linux - General 6 04-14-2011 06:25 AM
Argh! Need help with make and packages! TryingToUnderstand Linux - Newbie 10 08-03-2010 06:42 AM
Using Select to make a simple directory menu why doesn't it work ctrimble Programming 5 06-07-2004 02:21 AM
Tape drive that used to work... argh! budzynm Linux - Hardware 1 02-22-2004 07:36 PM
Argh! My mice dont work! curator Linux - Software 2 02-12-2001 10:14 AM

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

All times are GMT -5. The time now is 07:12 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration