Hello this is my first post on these forums.

For a little back ground into this, I recently installed a Linux server with the purpose of recording matches via a program called HLTV.

Now what I want to do is take the individual .dem files compress them one by one then move the compressed files to a different folder and delete the originals

I found a script that seemed to do the job but it doesn’t work and I can’t seem to debug it.

#!/bin/bash
HLDS= /hlds/cstrike/ #Working directory where demos are
REP=/hlds/cstrike/demos/ #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 source folder is /hlds/cstrike
destination folder is /hlds/cstrike/demos

file type is .dem


Thanks for any help.

without really looking hard at the code, these variable declarations will not work

this one the space can't be used

HLDS= /hlds/cstrike/

it needs to be

HLDS=/hlds/cstrike

also this will not work

FORMAT=tar cvf

I think you want to do this, you will need to place it in quotes

FORMAT="tar cvf"

actually I was just about to give it a try

Im hoping so, would save me a bit of work

This article has been dead for over six months. Start a new discussion instead.