fr-FR/LimitFileSize-help.xml

<?xml version="1.0" encoding="utf-8"?>
<helpItems schema="maml" xmlns="http://msh">
  <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
    <command:details>
      <command:name>Set-LimitFileSize</command:name>
      <command:verb>Set</command:verb>
      <command:noun>LimitFileSize</command:noun>
      <maml:description>
        <maml:para>Reduces the size of one or more text files by keeping only the most recent lines until a specified size threshold is met.</maml:para>
      </maml:description>
    </command:details>
    <maml:description>
      <maml:para>This script is designed to automatically manage large files (such as logs). For each specified file, if it exceeds a size threshold in Ko or Mo (defined by the MaxSize parameter), its content is re-read line by line, skipping empty lines. The lines are processed in reverse order (from most recent to oldest) until the accumulated data stays below the threshold.</maml:para>
      <maml:para>The output is written to a temporary file to avoid issues related to file locking by another process, then the temporary file replaces the original. No unwanted trailing newline is added at the end of the rewritten file.</maml:para>
      <maml:para>You can provide one or more file paths to trim multiple files in a single execution.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>Set-LimitFileSize</maml:name>
        <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
          <maml:name>Path</maml:name>
          <maml:description>
            <maml:para>Specifies one or more absolute or relative paths to the file(s) to be analyzed and potentially trimmed.</maml:para>
          </maml:description>
          <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
          <dev:type>
            <maml:name>String[]</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
          <maml:name>MaxSize</maml:name>
          <maml:description>
            <maml:para>The maximum size the file is allowed to reach before triggering a trimming operation.</maml:para>
            <maml:para>The value must be a number followed optionally by a unit : - Use "Ko" for kilooctets (e.g., "100000Ko")</maml:para>
            <maml:para>- Use "Mo" for megaoctets (e.g., "150Mo")</maml:para>
            <maml:para>- If no unit is specified, kilooctets are assumed by default (e.g., "200" means "200Ko").</maml:para>
            <maml:para></maml:para>
            <maml:para>Default: "256Ko"</maml:para>
          </maml:description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>256Ko</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none">
          <maml:name>VerboseLevel</maml:name>
          <maml:description>
            <maml:para>Controls the script's verbosity level : - "Disabled" : no console output.</maml:para>
            <maml:para>- "Normal" : minimal output.</maml:para>
            <maml:para>- "Debug" : displays details such as initial and final file size.</maml:para>
          </maml:description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>Disabled</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi">
          <maml:name>WhatIf</maml:name>
          <maml:description>
            <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para>
          </maml:description>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>False</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf">
          <maml:name>Confirm</maml:name>
          <maml:description>
            <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para>
          </maml:description>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>False</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga">
          <maml:name>ProgressAction</maml:name>
          <maml:description>
            <maml:para>{{ Fill ProgressAction Description }}</maml:para>
          </maml:description>
          <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue>
          <dev:type>
            <maml:name>ActionPreference</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters>
      <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
        <maml:name>Path</maml:name>
        <maml:description>
          <maml:para>Specifies one or more absolute or relative paths to the file(s) to be analyzed and potentially trimmed.</maml:para>
        </maml:description>
        <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
        <dev:type>
          <maml:name>String[]</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
        <maml:name>MaxSize</maml:name>
        <maml:description>
          <maml:para>The maximum size the file is allowed to reach before triggering a trimming operation.</maml:para>
          <maml:para>The value must be a number followed optionally by a unit : - Use "Ko" for kilooctets (e.g., "100000Ko")</maml:para>
          <maml:para>- Use "Mo" for megaoctets (e.g., "150Mo")</maml:para>
          <maml:para>- If no unit is specified, kilooctets are assumed by default (e.g., "200" means "200Ko").</maml:para>
          <maml:para></maml:para>
          <maml:para>Default: "256Ko"</maml:para>
        </maml:description>
        <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
        <dev:type>
          <maml:name>String</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>256Ko</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none">
        <maml:name>VerboseLevel</maml:name>
        <maml:description>
          <maml:para>Controls the script's verbosity level : - "Disabled" : no console output.</maml:para>
          <maml:para>- "Normal" : minimal output.</maml:para>
          <maml:para>- "Debug" : displays details such as initial and final file size.</maml:para>
        </maml:description>
        <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
        <dev:type>
          <maml:name>String</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>Disabled</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi">
        <maml:name>WhatIf</maml:name>
        <maml:description>
          <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para>
        </maml:description>
        <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>False</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf">
        <maml:name>Confirm</maml:name>
        <maml:description>
          <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para>
        </maml:description>
        <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>False</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga">
        <maml:name>ProgressAction</maml:name>
        <maml:description>
          <maml:para>{{ Fill ProgressAction Description }}</maml:para>
        </maml:description>
        <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue>
        <dev:type>
          <maml:name>ActionPreference</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
    </command:parameters>
    <command:inputTypes />
    <command:returnValues />
    <maml:alertSet>
      <maml:alert>
        <maml:para>Version : 1.0.0 Author : Frederic PETIT Created : 2025-05-22 Revised : 2025-05-31</maml:para>
        <maml:para>Compatibility: PowerShell 5+</maml:para>
      </maml:alert>
    </maml:alertSet>
    <command:examples>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
        <dev:code>Set-LimitFileSize -Path "lorem.txt" -MaxSize 3Ko -VerboseLevel Debug</dev:code>
        <dev:remarks>
          <maml:para>This will check if the file "lorem.txt" exceeds 3 Ko. If so, it will delete the oldest lines, keeping only the most recent ones until the size is below 5 Mo.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title>
        <dev:code>Set-LimitFileSize -Path "C:\Logs\app1.log", "C:\Logs\app2.log" -MaxSize 10Mo -VerboseLevel Debug</dev:code>
        <dev:remarks>
          <maml:para>This will check if either app1.log or app2.log exceeds 256 Ko. If so, it will keep only the most recent lines from each file until the size falls below the threshold.</maml:para>
        </dev:remarks>
      </command:example>
    </command:examples>
    <command:relatedLinks />
  </command:command>
  <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
    <command:details>
      <command:name>Watch-LimitFileSize</command:name>
      <command:verb>Watch</command:verb>
      <command:noun>LimitFileSize</command:noun>
      <maml:description>
        <maml:para>Creates or updates a scheduled task to monitor one or more files.</maml:para>
      </maml:description>
    </command:details>
    <maml:description>
      <maml:para>This function creates a Windows scheduled task named "WatchLimitFileSize" that runs the Set-LimitFileSize cmdlet on one or more specified paths. It also applies strict ACLs to these files/folders if the Set-RestrictiveACL module is available. The task is started immediately after being created or updated.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>Watch-LimitFileSize</maml:name>
        <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
          <maml:name>Path</maml:name>
          <maml:description>
            <maml:para>Array of strings containing one or more file or folder paths to monitor. Examples: 'C:\logs\app.log', 'D:\data\config.txt'.</maml:para>
          </maml:description>
          <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
          <dev:type>
            <maml:name>String[]</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
          <maml:name>MaxSize</maml:name>
          <maml:description>
            <maml:para>The maximum size the file is allowed to reach before triggering a trimming operation.</maml:para>
            <maml:para>The value must be a number followed optionally by a unit : - Use "Ko" for kilooctets (e.g., "100000Ko")</maml:para>
            <maml:para>- Use "Mo" for megaoctets (e.g., "150Mo")</maml:para>
            <maml:para>- If no unit is specified, kilooctets are assumed by default (e.g., "200" means "200Ko").</maml:para>
            <maml:para></maml:para>
            <maml:para>Default: "256Ko"</maml:para>
          </maml:description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>256Ko</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none">
          <maml:name>VerboseLevel</maml:name>
          <maml:description>
            <maml:para>Controls the script's verbosity level : - "Disabled" : no console output.</maml:para>
            <maml:para>- "Normal" : minimal output.</maml:para>
            <maml:para>- "Debug" : displays details such as initial and final file size.</maml:para>
          </maml:description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>Disabled</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi">
          <maml:name>WhatIf</maml:name>
          <maml:description>
            <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para>
          </maml:description>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>False</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf">
          <maml:name>Confirm</maml:name>
          <maml:description>
            <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para>
          </maml:description>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>False</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga">
          <maml:name>ProgressAction</maml:name>
          <maml:description>
            <maml:para>{{ Fill ProgressAction Description }}</maml:para>
          </maml:description>
          <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue>
          <dev:type>
            <maml:name>ActionPreference</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters>
      <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
        <maml:name>Path</maml:name>
        <maml:description>
          <maml:para>Array of strings containing one or more file or folder paths to monitor. Examples: 'C:\logs\app.log', 'D:\data\config.txt'.</maml:para>
        </maml:description>
        <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
        <dev:type>
          <maml:name>String[]</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
        <maml:name>MaxSize</maml:name>
        <maml:description>
          <maml:para>The maximum size the file is allowed to reach before triggering a trimming operation.</maml:para>
          <maml:para>The value must be a number followed optionally by a unit : - Use "Ko" for kilooctets (e.g., "100000Ko")</maml:para>
          <maml:para>- Use "Mo" for megaoctets (e.g., "150Mo")</maml:para>
          <maml:para>- If no unit is specified, kilooctets are assumed by default (e.g., "200" means "200Ko").</maml:para>
          <maml:para></maml:para>
          <maml:para>Default: "256Ko"</maml:para>
        </maml:description>
        <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
        <dev:type>
          <maml:name>String</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>256Ko</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none">
        <maml:name>VerboseLevel</maml:name>
        <maml:description>
          <maml:para>Controls the script's verbosity level : - "Disabled" : no console output.</maml:para>
          <maml:para>- "Normal" : minimal output.</maml:para>
          <maml:para>- "Debug" : displays details such as initial and final file size.</maml:para>
        </maml:description>
        <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
        <dev:type>
          <maml:name>String</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>Disabled</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi">
        <maml:name>WhatIf</maml:name>
        <maml:description>
          <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para>
        </maml:description>
        <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>False</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf">
        <maml:name>Confirm</maml:name>
        <maml:description>
          <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para>
        </maml:description>
        <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>False</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga">
        <maml:name>ProgressAction</maml:name>
        <maml:description>
          <maml:para>{{ Fill ProgressAction Description }}</maml:para>
        </maml:description>
        <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue>
        <dev:type>
          <maml:name>ActionPreference</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
    </command:parameters>
    <command:inputTypes />
    <command:returnValues />
    <maml:alertSet>
      <maml:alert>
        <maml:para>Version : 1.0.0 Author : Frederic PETIT Created : 2025-05-22 Revised : 2025-05-31</maml:para>
        <maml:para>Compatibility: PowerShell 5+</maml:para>
      </maml:alert>
    </maml:alertSet>
    <command:examples>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
        <dev:code>Watch-LimitFileSize -Path "C:\Logs\app.log"</dev:code>
        <dev:remarks>
          <maml:para>Creates the scheduled task to monitor a single file.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title>
        <dev:code>Watch-LimitFileSize -Path "C:\Logs\app1.log", "C:\Logs\app2.log"</dev:code>
        <dev:remarks>
          <maml:para>Creates the scheduled task to monitor multiple files.</maml:para>
        </dev:remarks>
      </command:example>
    </command:examples>
    <command:relatedLinks />
  </command:command>
</helpItems>