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
tryed this also
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
era
August 28, 2008, 3:39pm
2
The first script looks excellent, if you run it like 3gptozip *.3gp
sorry to be a bit stupid but how or what do i change and where to make this work
am i not doing the
zip -j "$f.zip" "$f"
part right
or is there a problem, in the echo commands
i was tying to run it with
nohup ./3gptozip.sh &
and
./3gptozip.sh
but is that the problem
thanks, i'm new to shell scripting by the way
era
August 28, 2008, 4:07pm
4
The problem is that you need to list the files you want to zip on the command line, the script doesn't contain this information. "$@" contains the arguments passed to the script on the command line.
how whould i do that in shell ??
is it something like
nohup ./3gptozip.sh *.3gp &
or
./3gptozip.sh *.3gp
or is that the incorrect way to do it, thanks for help by the way
how to zip individual files (.txt) into its own zip file.
is it something like
directory name 'test'
for file in test/* do zip $file.zip $file.txt?
it's not working. please help.
for file in $(find ./test -type f);do zip ${file}.zip $file;done
use fine with the option '-type f' so you only find files and not directories.