From owner-freebsd-questions@FreeBSD.ORG Tue Sep 21 05:16:50 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 483F5106564A for ; Tue, 21 Sep 2010 05:16:50 +0000 (UTC) (envelope-from editor@d3photography.com) Received: from qmta02.westchester.pa.hmc1.comcast.net (qmta02.westchester.pa.hmc1.comcast.net [76.96.53.9]) by mx1.freebsd.org (Postfix) with ESMTP id 08B288FC0C for ; Tue, 21 Sep 2010 05:16:49 +0000 (UTC) Received: from omta02.westchester.pa.hmc1.comcast.net ([76.96.53.7]) by qmta02.westchester.pa.hmc1.comcast.net with comcast id 9HD71f00609Ku2s09HGpim; Tue, 21 Sep 2010 05:16:49 +0000 Received: from [10.0.1.9] ([70.89.202.1]) by omta02.westchester.pa.hmc1.comcast.net with bizsmtp id 9HGo1f00402K3z202HGoJ3; Tue, 21 Sep 2010 05:16:49 +0000 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Ryan Coleman In-Reply-To: <4C983F1F.700@infracaninophile.co.uk> Date: Tue, 21 Sep 2010 00:16:48 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <70BA7AC2-7300-41F6-9D3E-7AFEAD7F533E@d3photography.com> <4C983F1F.700@infracaninophile.co.uk> To: Matthew Seaman X-Mailer: Apple Mail (2.1081) Cc: FreeBSD Questions Subject: Re: Zip file making issues X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2010 05:16:50 -0000 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). >=20 > Um.... changing directory *is* the way to solve this. Really. >=20 > 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). >=20 > ( > cd /mount/archive/orders/Sep20/1284343047-Le-ach/ ; > zip -r > = /usr/www/d3photography.com/htdocs/images/paidphotos/1284343047-Le-ach.zip = \ > download* > ) >=20 > Cheers, >=20 > Matthew >=20 > --=20 > Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard > Flat 3 > PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate > JID: matthew@infracaninophile.co.uk Kent, CT11 9PW >=20