•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 402,749 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,520 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 5016 | Replies: 4
![]() |
•
•
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.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
animations commercial computer dell development drivers enterprise firefox fix flash games gpl graphics hidden files how ibm intel interactivity. internet java linux microsoft microsystems mozilla multimedia news open open source open-source openbsd opengl openoffice operating profits red hat rhel scripting server software solve source sun super system ubuntu vista web development wesnoth windows xp
- 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


Linear Mode