Zip file making issues

Matthew Seaman m.seaman at infracaninophile.co.uk
Tue Sep 21 05:14:28 UTC 2010


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20100921/e04a53e6/signature.pgp


More information about the freebsd-questions mailing list