Skip to main content

CLI to inspect and set file timestamps (atime, mtime, btime, and best-effort ctime).

Project description

timectl

Command-line tool to inspect and adjust file and directory timestamps (atime, mtime, btime, and best-effort ctime).

Testing: This project has only been tested on macOS 26. Behavior on other operating systems or versions is not guaranteed.

Requirements

  • Python 3.10 (see pyproject.toml)

Install

Recommended: add the CLI from PyPI with uv’s tool installer (see Using tools):

uv tool install timectl
timectl --help

To run a one-off command without installing the tool globally, use uvx (alias for uv tool run):

uvx timectl --help
uvx timectl inspect .

You can also install from PyPI with pip:

pip install timectl
timectl --help

To work on this repository from a clone, use uv sync and uv run timectl ….

Commands

inspect

Show atime, mtime, ctime, and btime (when available) for a single path. Times are printed in the system local timezone.

timectl inspect              # default: current directory
timectl inspect path/to/file

set

Update timestamps for one root path (default: current directory). By default, directories are processed recursively (all entries under the tree).

timectl set [path] [--time <value>] [--fields <letters>] [--no-recursive]
Option Description
--time Target time; default is now. See Time formats.
--fields Which fields to change: a (atime), m (mtime), c (ctime), b (btime). Default: amcb.
--no-recursive Do not walk into subdirectories when path is a directory.

Field notes:

  • a / m: Set via os.utime to the value of --time.
  • b: On macOS, the tool tries Apple’s SetFile (from Xcode Command Line Tools) when available; otherwise b may be skipped with a reason in the output.
  • c: The system does not allow setting ctime to an arbitrary value. With c in --fields, the tool refreshes ctime to the current moment after other updates. Therefore c is only allowed when --time is now (including the default). If --time is anything else and c is included (including the default amcb), the command exits with an error—use e.g. --fields amb to omit c.

Time formats

  • now
  • ISO 8601 (e.g. 2026-03-30T12:34:56+08:00)
  • YYYY-MM-DD HH:MM:SS (interpreted in the local timezone if no offset is given)
  • Unix seconds: @1711767296
  • Nanoseconds: @1711767296000000000ns

Examples

# Inspect a file
timectl inspect ./README.md

# Set everything to now under current directory (default path, --time, --fields)
timectl set

# Set everything to now under a given root
timectl set ./some/dir

# Set atime/mtime/btime to a fixed time (omit c)
timectl set ./file.txt --time "2026-03-30 22:00:00" --fields amb

# Only touch the directory itself, not children
timectl set ./folder --no-recursive --time now

Limitations

  • ctime cannot be set to a specific historical time; only a “touch to now” style refresh is supported, and only when --time is now.
  • btime support depends on the platform and tools (on macOS, SetFile is used when present).
  • Cross-platform and cross-filesystem timestamp semantics differ; this tool does not promise identical results outside the tested environment.

License

This project is licensed under the MIT License.

Project details


Download files

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

Source Distribution

timectl-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

timectl-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file timectl-0.1.0.tar.gz.

File metadata

  • Download URL: timectl-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for timectl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 de092b3b414b9475a832e81e99bfd8586bdd8ad2f7a29838152dde82f99c5ab8
MD5 8cf939a8c0a5cfb063857a46a6febe14
BLAKE2b-256 9a03d38092f7b07f3ca3f6a1664fdd95aa0b42436817c7b84e022ba0fd13d3ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for timectl-0.1.0.tar.gz:

Publisher: publish.yml on touken928/timectl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file timectl-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: timectl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for timectl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc118bd931271b0c1ccabdf017fa8d30b311d0b9af5c6355d7e0d2600fc5ec82
MD5 01c7a5ae016e1160ff22814a1d45fb79
BLAKE2b-256 f510917c21c9f122c386e339057d830dc80b02848606749cca77ab8bd13f8498

See more details on using hashes here.

Provenance

The following attestation bundles were made for timectl-0.1.0-py3-none-any.whl:

Publisher: publish.yml on touken928/timectl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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