The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-28-2008
wingchun22 wingchun22 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 19
batch shell script to zip individual files in directory - help

help trying to figure out a batch shell script to zip each file in a directory into its own zip file

using this code but it does not work

Quote:
#!/bin/bash
echo "3gptozip converter"
for f in "$@"
do
zip -j "$f.zip" "$f"
done
echo "Finished with 3gptozip converter"
tryed this also

Quote:

#!/bin/bash
echo "3gptozip converter"
if (($# ==0))
then
echo "Usage: 3gptozip [3gp files] ..."
exit
fi
while (($# !=0 ))
do
zip $1.zip $1
shift
done
echo "Finished with 3gptozip converter"
nothing seems to work , just ends without zipping any files

i have over 3000 files i need to zip up individualy

files to be zipped are in this format 123.flv.3gp

hopfully ending up like 123.flv.3gp.zip

is the file structure the problem

running a single zip command from shell seems to work ok

thanks for help in advance