-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 12 October 2002 07:16 am, you wrote:
> Well, there's probably a much simpler way, but I've wrote you a little
> script to do this.

well... simpler, doesnt always make it fun'r :)


>The script follows:
>
> #!/bin/sh
>
> # zip.sh
> #
> # This script just zips multiple files in the current directory.
> # The files are zipped as their own individual archives, not one large
> # archive as zip would normally do.
> # Written by Todd Flinders 12 Oct 2002
>
> files=`ls`
> suffix=.zip
>
> # For each file in the current directory...
> for filename in $files
> do
>         # Let's not zip the script!
>         if [ ! "$filename" == "$0" ]
>         then
>                 # Make sure we're going to zip a file, not a directory
>                 if [ -f $filename ]
>                 then
>                         # sed strips the suffix from the file
>                         # The if returns TRUE if the file had no suffix
>                         # The if returns FALSE if the file did have a
> suffix if [[ `echo $filename | sed s/\.[A-Za-z0-9~\-]*$//p` == "" ]]
>                         then
>                                 # no suffix so the filename doesn't change
>                                 zipfile=$filename
>                         else
>                                 # remove the suffix to be replaced with
> .zip zipfile=`echo $filename | sed
> s/\.[A-Za-z0-9~\-]*$//`
>                         fi
>                         # zip the current file
>                         zip -9 $zipfile$suffix $filename
>                 fi
>         fi
> done

it works MUCH better then the one I had.. :)

excpet.... that if a filename has <spaces> in it, ie:

long filename with lots of fun spaces and (13-J).xxx

the script bombs out of the loop, even if there are more files to process... :/

anyway.. thanks for your help, its been a LONG time since I had to write scripts, and 
that was back in the ms-dos days :-P



drwhat

*******#######$$$$$$$$@@@@@@@@@@@@@@@@
Linux user #:265953
Today is Tommorrow, is Yesterday, but neither, is niether
loc:48'02"N 122'49"W

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9qGreeyQvdOSh1pcRAmOnAKCKgFiV6l2eLOizn0EXQLFH3hmOfwCfX5wq
GlDzVvbzghtN1gjXnk0lbFY=
=CJUl
-----END PGP SIGNATURE-----


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to