Skip to main content

FileCycle: Python File Rotation Manager

FileCycle is a Python library designed to manage file rotation in a specified directory. It automatically organizes files into dated folders and applies a retention policy to remove old files. This ensures that you keep only the data you need for a specified period.

Key Features:

  • Automated File Rotation: Automatically moves files into dated folders based on the current date.

  • Retention Policy: Cleans up old files based on a user-defined retention period, specified in days.

  • Customizable Working Directory: Allows you to set the working directory where the file rotation and retention will occur.

  • Version Listing: Provides a method to list all available versions (dated folders) in the working directory.

This library is particularly useful for applications that generate time-sensitive data files that need to be retained for a specific period.

Installation

Copy the FileCycle class into your project.

Features

  • Automated File Rotation: Moves files into dated folders based on the current date.
  • Retention Policy: Removes old files based on a user-defined retention period.
  • Customizable Working Directory: Allows you to set the working directory for file rotation.
  • Version Listing: Lists all available versions (dated folders) in the working directory.

Usage

Initialization

PIP: pip install file-cycle

Manually: Initialize the FileCycle class by specifying the working directory prefix, the working directory, and the retention days.

from FileCycle import FileCycle  # Assuming FileCycle is in a file named FileCycle.py

# Initialize with default settings
file_cycle = FileCycle()

# Or specify custom settings
file_cycle = FileCycle(workdir_prefix="/your/prefix", workdir="/your/dir", retention_days=15)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

file_cycle-0.0.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

file_cycle-0.0.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file file_cycle-0.0.2.tar.gz.

File metadata

  • Download URL: file_cycle-0.0.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for file_cycle-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4e7b96b432bee8f698d264b012fbf1d06df30e43fd101c0e3427a966d6cff88f
MD5 4a087d0dfeb28d80254c1305f321b03b
BLAKE2b-256 65b7f87fa06555576a3dccd30c522d7163c16e10b353a720652f448f8f70cbd8

See more details on using hashes here.

File details

Details for the file file_cycle-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: file_cycle-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for file_cycle-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3b798a74694653ddaf800088eb73e8f6b95add6d724ce0091a8cde489cf8272f
MD5 ddb5062c69047dce38ef582576642d36
BLAKE2b-256 05ee12a128eccfe6a736dfdf0b58a3590906a7eba95080a79f9ba471a663ecdf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page