Re: unzip | touch | re-zip




"Murray R. Van Luyn." <valid@xxxxxxxxxxxxx> wrote in message
news:vsednRKwVb5_NqDWnZ2dnUVZ_umdnZ2d@xxxxxxxxxxxxxxxxx

"mop2" <invalid@xxxxxxxxxxxx> wrote in message
news:op.u5tpileof8ly3v@xxxxx
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
to
get a zipfile download preparation script in PHP to work on my website.
The
idea is just to touch the payload timestamps of my zipfile downloads, as
a
means of having then uniquely traceable to individual microcontroller
software purchasers.


rezip(){
[ $1 ]&&[ -e $1]||return

I'm fascinated by this snippet, mop2. What sort of language is that
function
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
exec()
function to run 'zip' consistently. It might be handy if I could
fire-off a
shell script with something like exec("rezip file.zip");

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
stored
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
>/your/download/area/yourprg-1.0.0.zip

######

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 zipfile1.zip zipfile2.zip
zipfile3.zip");

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
fun!

Muz.


Does this look rational to anyone?

#!/bin/sh

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
shift
done

exit 0


Called with something like:

../touchzipfilepayloads zipfile1.zip zipfile2.zip zipfile3.zip

Muz.


.



Relevant Pages

  • PHP SCRIPT
    ... php classified script ... guestbook ardguest free php guestbook script ... php file upload script ...
    (sci.chem.labware)
  • Re: [PHP] Catch STDERR
    ... into your PHP script? ... Or do you just need STDOUT in one variable, and STDERR in another, ... Another option is to try to write a .sh shell script to get what you ...
    (php.general)
  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... This is why I am thinking about rewriting my whole script in a C language. ... Perhaps there are different methods I could be using to speed up execution. ...
    (php.general)
  • Re: unzip | touch | re-zip
    ... get a zipfile download preparation script in PHP to work on my website. ... shell script with something like exec; ...
    (comp.unix.shell)
  • Re: How to Add a Feeback Form
    ... I saw nothing in that script that indicates where the form is e-mailed to so ... Greg Maxey/Word MVP ... PHP or not. ... have the support available yet. ...
    (microsoft.public.frontpage.programming)