mrfelpa / Clean_temp

Python script that automates the cleaning of temporary files from the operating system. It identifies and removes old files from the default temporary directory, freeing up disk space.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Features

  • Verify that the script is running with administrative privileges.
  • Retrieves the default system temporary directory.
  • Sets a time limit (files older than 7 days).
  • Traverses all files in the temporary directory.
  • Checks if the file is older than the limit.
  • Deletes the file (logging errors if they occur).
  • Records the amount of deleted files and the space released.
  • (Optional): Adds script to system startup (Windows only).
  • Retrieves the path of the script.
  • Check the operating system.
  • Adds the script to the startup registry (HKEY_CURRENT_USER Software Microsoft Windows CurrentVersion Run).
  • Records the success or failure of the addition.

Requirements

  • Python 3.x
  • Windows (the tool is specific to Windows systems)

How to Use

  • Download the cleantemp.py
  • Run the file with administrator privileges.
  • The tool will clean temporary files older than a week and add itself to the system start.

Record

The log file (cleantemp.log) is created in the same directory as the script and records information such as:

  • Date and time
  • Event Level (INFO or ERROR)
  • Event descriptive message (e.g., file deleted successfully, error during deletion)

log_temp

License

This project is licensed under the MIT license. See the LICENSE file for details.

Contributing

We value contributions! Feel free to submit suggestions, report issues, or submit improvement requests through GitHub issues.

About

Python script that automates the cleaning of temporary files from the operating system. It identifies and removes old files from the default temporary directory, freeing up disk space.

License:MIT License


Languages

Language:Python 100.0%