Jump to content

[Tool] AutoCleanFiles - Delete old Files/Recordings on low disk space


popy

Recommended Posts

Hey.

 

Sadly DVBViewer does'nt support this feature i have written an AutoIt script which deletes old files/recordings on low disk space.

 

This Tool recursive deletes files (ex.: recordings) in an folder (SearchPath) if free disk space of the drive is under ThresholdMB.
Also a filter (SearchExtension & OptionalExtensions) should be used.
If the ThresholdMB is reched, files up to DeleteMB will be deleted.
Optional a recording database cleanup task can be triggered after deleting of the files.

 

Just to be sure you know what you are doing: You can loos data if you use this tool wrong, always backup!

 

Here is the Readme file:

 

AutoCleanFiles v1.0
by pOpY 2018

************************************
***********Disclaimer***************
************************************

	Deutsch:
	
		!! ACHTUNG !! Dieses Tool löscht Dateien von Ihrer Festplatte.
		Bei falscher Konfiguration bzw. Programmfehlern kann es zu Datenverlust kommen.
		Ich hafte in keinster weise dafür!!!! Durch Benutzung dieses Tools stimmen
		Sie diesem Absatz zu! 

	English:

		!! This Tool deletes files from your harddrive.
		There could be lost of data If your configuration is wrong or there are program errors.
		It is your fault if you doesnt use thius tool correctly.
		With the installation of this tool you agree to this.

************************************
**************Info******************
************************************

	Deutsch:
	
		Dieses Tool löscht rekursiv Dateien (z.B.: Aufnahmen) in einem Verzeichnis (SearchPath) wenn der Freie Speicherplatz des Laufwerks das Limit ThresholdMB unterschreitet.
		Außerdem sollte der Filter (SearchExtension & OptionalExtensions) gesetzt werden um die Suche einzuschränken.
        Weiters kann mit DeleteMB festgelegt werden wieviel MegaBytes maximal gelöscht werden sollen.
		Optional kann nach dem löschen der Aufnahmen/Dateien ein Aufräumen der Aufnahme Datenbank des DVBViewer Media Server veranlasst werden (DMSHost & DMSPort)

	English:

		This Tool recursive deletes files (ex.: recordings) in an folder (SearchPath) if free disk space of the drive is under ThresholdMB.
		Also a filter (SearchExtension & OptionalExtensions) should be used.
        If the ThresholdMB is reched, files up to DeleteMB will be deleted.
        Optional a recording database cleanup task can be triggered after deleting of the files.
		
************************************
**********Installation**************
************************************

	Deutsch:
	
		* Einfach folgende Dateien in einen gewünschten Ordner kopieren (muss nicht der DVBViewer Ordner sein).
          Sollte aber ein Ordner sein wo Schreibrechte für den gewünschten User bestehen, da das Tool ein Log schreibt.
		
			AutoCleanFiles.exe          Haupt Programm
			AutoCleanFiles.ini			Einstellungsdatei (MUSS ANGEPASST WERDEN, siehe Beispiel unten)
    
        
	English:
	
		* Just copy the following files into any folder (must not be the DVBViewer folder).
          But an folder with write permissions because the application is writing a log file

			AutoCleanFiles.exe          Main application
			AutoCleanFiles.ini			Settings file (MUST BE ADJUSTED, see example)


********************************************
************ Parameter Info ****************
********************************************

	Deutsch:
    
        SearchPath                      Suchpfad für Dateien, ein Hauptverzeichnis wie C:\ ist aus SIcherheitsgründen nicht zugelassen!
        
        SearchExtension                 Datei Erweiterung nach der gesucht werden soll. Erlaubt ist *.EXT, .EXT oder EXT
        
        OptionalExtensions              Zusätzliche Datei Erweiterung die gelöscht werden sollen. Erlaubt ist *.EXT, .EXT oder EXT
                                        Mehrere Erweiterungen können mit , (Komma) getrennt angegbene werden.
                                        z.B.: Wird eine Name.ts gefunden kann auch eine Name.txt gelöscht werden
                                        
        ThresholdMB                     Wird der Freie Speicherplatz in MegaBytes am Laufwerk von SearchPath unterschritten wird bis zu DeleteMB Dateien gelöscht
        
        DeleteMB                        Anzahl an MegaBytes welche gelöscht werden sollen wenn das limit ThresholdMB unterschritten wird
        
        DMSHost                         IP/Computername vom DVBViewer Media Server WebInterface, wenn gesetzt wird die Aufgabe, zum Aufräumen der vorher gelöschten Aufnahmen, ausgeführt.
                                        Wenn nicht gesetzt/vorhanden wird das DMS nicht informiert.
                                        
        DMSPort                         Port vom DVBViewer Media Server WebInterfac, wenn gesetzt wird die Aufgabe, zum Aufräumen der vorher gelöschten Aufnahmen, ausgeführt.
                                        Wenn nicht gesetzt/vorhanden wird das DMS nicht informiert.
        TryRun                          0 = nichts wird gelöscht (Testlauf), 1 = Dateien werden gelöscht wenn ThresholdMB unterschritten wird
        
	English:
    
        SearchPath                      search path for files, a root directory like C:\ is not allowed
        
        SearchExtension                 file extenson to search for. Allowed is *.EXT, .EXT oder EXT
        
        OptionalExtensions              optional file extensions which should be deleted.  Allowed is *.EXT, .EXT oder EXT
                                        Multiple extension could be seperated with , (comma)
                                        ex: Was a Name.ts file found, Name.txt file will also be deleted
                                        
        ThresholdMB                     Is the free space of the drive from SearchPath under ThresholdMB, up to DeleteMB will be deleted
        
        DeleteMB                        COunt of MegaBytes which will be deleted when free disk space is under ThresholdMB
        
        DMSHost                         IP/hostname of DVBViewer Media Server WebInterface, if set, task to CleanUp recordings, will be executed.
                                        If not set/exists DMS will not be informed.
                                        
        DMSPort                         Port of DVBViewer Media Server WebInterface, if set, task to CleanUp recordings, will be executed.
                                        If not set/exists DMS will not be informed.
                                        
        TryRun                          0 = nothing will be deleted (Dry run), 1 = files will be deleted if ThresholdMB reached
 

************************************
****Konfiguration/Configuration*****
************************************

	Deutsch:
	
		* Einfach folgende Dateien in einen gewünschten Ordner kopieren (muss nicht der DVBViewer Ordner sein).
          Sollte aber ein Ordner sein wo Schreibrechte für den gewünschten User bestehen, da das Tool ein Log schreibt.
		
			AutoCleanFiles.exe          Haupt Programm
			AutoCleanFiles.ini			Einstellungsdatei (MUSS ANGEPASST WERDEN, siehe Beispiel unten)

        * Anpassen der Optionen in der Datei AutoCleanFiles.ini, ev. mit höherem ThreasholedMB, ABER BELASSEN SIE "TryRun=1" (siehe Beispiel unten)
        * AutoCleanFiles.exe ausführen um Testlauf auszuführen
          Es wird eine Warnung angezeigt ob die Optionen korrekt sind, prüfen Sie diese & bestätigen diese einmalig mit 'Ja'
        * Log prüfen und geg. Optionen anpassen und erneut einen Testlauf ausführen
        * Sind die Einstellungen korrekt, setzen Sie das korrekte Limit ThreasholedMB & setzen Sie "TryRun=0"
        * AutoCleanFiles.exe ausführen um Datein zu bereinigen
          Es wird eine Warnung angezeigt ob die Optionen korrekt sind, prüfen Sie diese & bestätigen diese einmalig mit 'Ja'       
        * In der Windows Aufgabenplanung bzw. im DVBViewer einen Task (mit erhöhten Rechten) anlegen wo AutoCleanFiles.exe in gewissen Intervallen bzw. nach einer Aufnahme ausgeführt wird.      
        
	English:
	
		* Just copy the following files into any folder (must not be the DVBViewer folder).
          But an folder with write permissions because the application is writing a log file

			AutoCleanFiles.exe          Main application
			AutoCleanFiles.ini			Settings file (MUST BE ADJUSTED, see example)

        * adjust settings in file AutoCleanFiles.ini, with higher ThreasholedMB for test reasons, LEAVE "TryRun=1" as it is!
        * run AutoCleanFiles.exe to start a dry run
          A warning will be displayed and asks the user to confirm the new settings, please check & confirm settings with 'Yes'
        * Check log an adjust settings if needed, relaunch another the dry run
        * Check if all is running well, set correct/lower ThreasholedMB & "TryRun=0"
        * run AutoCleanFiles.exe to start a live run and clean files
          A warning will be displayed and asks the user to confirm the new settings, please check & confirm settings with 'Yes'      
        * Create a task in the windows task scheduler or DVBViewer (with high previlegs) to run AutoCleanFiles.exe scheduled or after recording end

        
**********************************************************************
************ Beispiel Einstellungen / Sample settings ****************
**********************************************************************

        [Settings]
        SearchPath=F:\ServerFolders\TV-Aufzeichnung\RecService
        SearchExtension=*.ts
        OptionalExtensions=*.txt,*.edl
        ThresholdMB=30000
        DeleteMB=30000
        DMSHost=192.168.0.5
        DMSPort=8089
        TryRun=0   
		
*************************************************
********************Changelog********************
*************************************************

v1.0:
	* Initial Version

	
Sorry for my bad english ;-)
Viel Spaß damit
Have fun
pOpY 2018

 

Download: http://www.DVBViewer.tv/forum/applications/core/interface/file/attachment.php?id=46376

 

Have fun

pOpY

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...