Raised This Month: $51 Target: $400
 12% 

[Windows] CSGO Moving Demo files to different folder with Timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TandelK
Member
Join Date: Jun 2015
Location: Surat, India
Old 07-06-2018 , 03:26   [Windows] CSGO Moving Demo files to different folder with Timer
Reply With Quote #1

As i record Demos for my Call Admin Reports and other purposes, i basically wanted to share Demos with Public either on FTP or HTTP . So there was huge issue in start that basically CSGO didnt allow Auto Recorded Files to go to other Folders until i created a batch script on my system and added it in Time Scheduler Of Windows for every 4 Hours.

I am using XAMPP for website based download system. I am just mentioning common way of path.

Demo Path - C:\Retake\csgo\
XAMPP htdocs path- C:\XAMPP\htdocs\retakedemos


Batch File i created for every 4 hours running.
Code:
cd C:\Retake\csgo\
move *.dem C:\XAMPP\htdocs\retakedemos
It runs every 4 hours and moves all the demo files to retakedemos folder but issue i face is if the server is currently running it also moves that 0 kb file of Current Recording . If anyone knows how to restrict in use files ?
__________________
TandelK is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 07-07-2018 , 03:13   Re: [Windows] CSGO Moving Demo files to different folder with Timer
Reply With Quote #2

this little python script will move all files from ts to ts/asd and check their size to not be 0:

Code:
import os
import shutil

def getSize(filename):
    st = os.stat(filename)
    return st.st_size
	
def moveFile(file, des):
	shutil.move(file, des)

files = os.listdir("E:/ts")
files.sort()
for f in files:
	if getSize(f) != 0:
		moveFile(f, "E:/ts/asd")
not sure if it's what you want but this will do the moving stuff and you should probably run it with you scheduler once in a while and correct the paths (tested on windows you should use slash and not backslash in pathes)
__________________
ambn is offline
Kurtan
AlliedModders Donor
Join Date: Feb 2016
Location: Sweden
Old 07-08-2018 , 12:24   Re: [Windows] CSGO Moving Demo files to different folder with Timer
Reply With Quote #3

Quote:
Originally Posted by ambn View Post
this little python script will move all files from ts to ts/asd and check their size to not be 0:

Code:
import os
import shutil

def getSize(filename):
    st = os.stat(filename)
    return st.st_size
	
def moveFile(file, des):
	shutil.move(file, des)

files = os.listdir("E:/ts")
files.sort()
for f in files:
	if getSize(f) != 0:
		moveFile(f, "E:/ts/asd")
not sure if it's what you want but this will do the moving stuff and you should probably run it with you scheduler once in a while and correct the paths (tested on windows you should use slash and not backslash in pathes)
I'm using the find application in linux to do this. You need to check the last modified date. Make sure it hasn't been modifed for 5-10 minutes, then move it to make sure it is done. Either that, or check if there is a newer *.dem file in the same directory.
__________________
Kurtan is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 07-09-2018 , 03:34   Re: [Windows] CSGO Moving Demo files to different folder with Timer
Reply With Quote #4

Quote:
Originally Posted by Kurtan View Post
I'm using the find application in linux to do this. You need to check the last modified date. Make sure it hasn't been modifed for 5-10 minutes, then move it to make sure it is done. Either that, or check if there is a newer *.dem file in the same directory.
why and how a demo could get modified if it's not been overwritten? i guess the op is pretty sure he is always getting the fresh demo and not modified ones but anyway in different cases what you said might be required
__________________
ambn is offline
Kurtan
AlliedModders Donor
Join Date: Feb 2016
Location: Sweden
Old 07-09-2018 , 12:20   Re: [Windows] CSGO Moving Demo files to different folder with Timer
Reply With Quote #5

Quote:
Originally Posted by ambn View Post
why and how a demo could get modified if it's not been overwritten? i guess the op is pretty sure he is always getting the fresh demo and not modified ones but anyway in different cases what you said might be required
By modified I mean when the demo is being updated. Each increment of demo causes a new modify date on the file. A demo file can never been overwritten because of unique name based on some factors.
__________________
Kurtan is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode