Please support our Shell Scripting advertiser: Programming Forums
![]() |
•
•
Join Date: Aug 2005
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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.
the source folder is /hlds/cstrike
destination folder is /hlds/cstrike/demos
file type is .dem
Thanks for any help.
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.
•
•
Join Date: May 2005
Posts: 215
Reputation:
Rep Power: 4
Solved Threads: 0
without really looking hard at the code, these variable declarations will not work
this one the space can't be used
it needs to be
also this will not work
I think you want to do this, you will need to place it in quotes
this one the space can't be used
HLDS= /hlds/cstrike/
HLDS=/hlds/cstrike
also this will not work
FORMAT=tar cvf
FORMAT="tar cvf"
In a perfect world exceptions would not be needed.
![]() |
Similar Threads
Other Threads in the Shell Scripting Forum
- Writing mp3 files to data files (OS X)
- PC Cleaning Procedures & Detection Tools (Viruses, Spyware and other Nasties)
- My friend's 317 Error (Viruses, Spyware and other Nasties)
- Aurora Help Badly needed! Thank you! (Viruses, Spyware and other Nasties)
Other Threads in the Shell Scripting Forum
- Previous Thread: Echoing TABs?
- Next Thread: Shell Script Issue
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode