A little script for compression :(
Hi, first of all, sorry for my poor english. I found a little script on the web, that compress some files in .tar format and I modified it a bit. Here it is:
#!/bin/bash
HLDS=/mypath/ #Working directory where demos are
REP=/mypath/ #copying directory
FORMAT=`tar -cvf`
EXTENSION=tar
#FORMAT=zip #Compression using ZIP
#EXTENSION=zip #Associated extension
cd $HLDS
for files in `ls *.dem` do
$FORMAT $files.$(date +%s).$EXTENSION $files
echo "$files.$(date +%s).$EXTENSION compressed"
mv $files.$(date +%s).$EXTENSION $REP
echo "$files.$(date +%s).$EXTENSION moved"
rm $files
echo "$files deleted"
done;
echo "Demos are available in : $REP"
The result is:
tar: option requires an argument -- f
Try `tar --help' for more information
./zipDemos: line 10: syntax error near unexpected token `$FORMAT'
./zipDemos: line 10: ` $FORMAT $files.$(date +%s).$EXTENSION $files'
I think the problem, is the argument of the command tar, but I dont understand why it doesn't work. My linux is debian. Thank you for any help!
|