01-28-2005, 01:29 PM
#!/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"
Result:
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'
The problem, I think, is the argument of the command tar...
But...why???
Thank you for any help ^^.
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"
Result:
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'
The problem, I think, is the argument of the command tar...
But...why???
Thank you for any help ^^.