Re: unzip | touch | re-zip

"Murray R. Van Luyn." <valid@xxxxxxxxxxxxx> wrote in message

"mop2" <invalid@xxxxxxxxxxxx> wrote in message
On Thu, 31 Dec 2009 19:30:10 -0200, Murray R. Van Luyn.
<valid@xxxxxxxxxxxxx> wrote:
Golly, I know next to nothing about Unix shell commands. I'm just trying
get a zipfile download preparation script in PHP to work on my website.
idea is just to touch the payload timestamps of my zipfile downloads, as
means of having then uniquely traceable to individual microcontroller
software purchasers.

[ $1 ]&&[ -e $1]||return

I'm fascinated by this snippet, mop2. What sort of language is that
written in? I may have to resort to some form of function loaded shell
script for my command sequence, as I'm having trouble getting PHP's
function to run 'zip' consistently. It might be handy if I could
fire-off a
shell script with something like exec("rezip");

That is a shell function.
Now what your need is more clear.

Well, for dating your files, your case is more simple. Your files can be
in a private directory and a script touch and zip them to a public
directory, so:

####your script (for zipping) is just:

touch /files/tozip/yourprg-1.0.0/*

/usr/bin/zip < /files/tozip/yourprg-1.0.0


You only need control the condition of only one download per time stamp.

Your php interpreter can run a shell script (I think), as above, or
perhaps just:

exec("line 1; line 2");

Sorry, I don't know nothing about php.

Hi Mop2,

Don't worry Mop2, I don't know nothing about PHP either. :-) The
searchable documentation and examples are fabulous, however, and inspired
cut & paste seems to get one a very long way.

Hmm...what I really need is to write a tiny shell script that can
iteratively work through a set of zip files, expanding, touching and
re-compressing the contents of each. The idea would be to call it with a
PHP command like exec("touchzipfilepayloads");

I'll have to search for a simple shell script example that illustrates the
control structure required to process a command line specified list of zip
files. Once I have that, it will be a simple matter of substituting my
unzip, touch, zip, rm command sequence.

Gee, I hope the shell program 'zip' works a little better for me when
called from a shell script. Otherwise, I'm no better off. Golly, isn't it
a stimulating exercise, to battle through the maze of possible solutions
and dead-ends, and finally arrive at working result? I'm having too much


Does this look rational to anyone?


while [ $# -ge 1 ]; do
unzip ./Secure/$1 -d ./Secure/Temp > /dev/null 2>&1
touch ./Secure/Temp/* > /dev/null 2>&1
zip -j ./Secure/$1 ./Secure/Temp/* > /dev/null 2>&1
rm ./Secure/Temp/* > /dev/null 2>&1

exit 0

Called with something like: