Zip file making issues

Ryan Coleman editor at d3photography.com
Tue Sep 21 05:16:50 UTC 2010


That changing of directories doesn't solve the PHP script I have building ZIP files, though, with a single shell command (path/to/zip /path/to/zip.zip -r /path/to/folder/to/zip).

But I have solved this now with another PHP script that I can call both as part of my Apache CGI but also as a CLI.

 I just have to implement it which I will do in the morning.

--
Ryan

On Sep 21, 2010, at 12:14 AM, Matthew Seaman wrote:

> On 21/09/2010 04:53:58, Ryan Coleman wrote:
>> As I said in my OP: I could just run a "cd" to the directory parent
>> and do it there - that would solve the problem - but that's simply
>> too dangerous if the script generator throws an error on the next set
>> of commands (a risk I do not want to take).
> 
> Um.... changing directory *is* the way to solve this.  Really.
> 
> What you can do in a shell script is work in a sub-shell: that way,
> even if your zip command goes bananas, you are automatically returned to
> your original working directory.  To create a sub-shell, just enclose
> your commands in (brackets).
> 
>   (
>      cd /mount/archive/orders/Sep20/1284343047-Le-ach/ ;
>      zip -r
> /usr/www/d3photography.com/htdocs/images/paidphotos/1284343047-Le-ach.zip \
>          download*
>   )
> 
> 	Cheers,
> 
> 	Matthew
> 
> -- 
> Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
>                                                  Flat 3
> PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
> JID: matthew at infracaninophile.co.uk               Kent, CT11 9PW
> 



More information about the freebsd-questions mailing list