Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 55656e68e4e1cc00cd7b9b0faae310dfebb0eab6420ba6fdc5961fcbab475862
Ticket: 516d581c047786f7a51e1a574e43e8832447cc07
A tcl command to report free usable space of a partition of native file system
User & Date: anonymous on 2025-12-11 14:46:10
Changes

  1. icomment:
    Sorry for this very late complementary explanation of the need expressed in this ticket.
    Once a year, our application makes a copy of some of its SQLite db files, outside of its working area for long term archival purpose.
    Below is a small Tcl script exerpt of what we do :
    
    ============================================================================
    
    # a) Check available free usable space on the target (in Mo)
         
         set freeArchiveSpace [exec java -classpath [file join $::_currentdir Lib] java_HDfreespace $tclArchivesPath]
    
    # b) Needed additional free space (in Mo)
                    
         set trentordbSpace  [format %.2f [expr {[file size [file join $::_currentdir Data trentordb.tr]]  / 1048576.0}]]
            set trentordb2Space [format %.2f [expr {[file size [file join $::_currentdir Data trentordb2.tr]] / 1048576.0}]]
            set dbdocSpace      [format %.2f [expr {[file size [file join $::_currentdir Etats dbdoc.tr]]     / 1048576.0}]]
            
    
            if {$freeArchiveSpace < $trentordbSpace + $trentordb2Space + $dbdocSpace} {
                
                # [A044] Erreur : espace de stockage disponible ($freeArchiveSpace Mo) insuffisant.
                tk_messageBox -parent  .menuGeneral \
                              -message [::msgcat::mc A044 $freeArchiveSpace] \
                              -type ok -icon error -title $::_appName
                
                # arrĂȘt des traitements
                return 9
            }
    
    ============================================================================
    
    where :
    - "java_HDfreespace" : java program' name whose code was provided in my previous post
    - $tclArchivesPath contains the absolute path to the directory where the db files are to be copied on the target, and passed as argument to java_HDfreespace program
    - trentordb.tr, trentordb2.tr and dbdoc.tr are three SQlites database files to be archived
    
    Final note : before executing the above excerpt, the application tries to shrink the db files as much as possible with VACUUM SQL command, whose logic by making a temporary copy of the db file processed, needs beforehand a check of available space where the application resides. It is again done in invoking the java program described in this ticket.
    
    Thank you again
    Jean-Marie
    
  2. login: "anonymous"
  3. mimetype: "text/plain"