crtime: get creation time of files for any platform and no external dependencies.
Project description
## crtime
[![Build Status](https://travis-ci.org/kootenpv/crtime.svg?branch=master)](https://travis-ci.org/kootenpv/crtime)
[![PyPI](https://img.shields.io/pypi/v/crtime.svg?style=flat-square)](https://pypi.python.org/pypi/crtime/)
[![PyPI](https://img.shields.io/pypi/pyversions/crtime.svg?style=flat-square)](https://pypi.python.org/pypi/crtime/)
Get creation time of files for any platform and no external dependencies.
### Caveat
Linux requires sudo! There is no way to avoid this, as creation time is not exposed by the kernel.
It uses debugfs to mount the filesystem, as the information is actually contained on most linux platforms.
Speed: because it does one query for a whole directory, it is roughly 1000x faster than any other method (such as the `xstat` utility that can be found online).
### Installation
pip install crtime
### Usage
In a shell:
```bash
crtime .
# 1552938709\tfile_a.py
```
In Python
```python
from crtime import get_ctimes_in_dir
for fname, date in get_ctimes_in_dir(".", raise_on_error=True, as_epoch=False):
print(fname, date)
# file_a.py Mon Mar 18 20:51:18 CET 2019
```
[![Build Status](https://travis-ci.org/kootenpv/crtime.svg?branch=master)](https://travis-ci.org/kootenpv/crtime)
[![PyPI](https://img.shields.io/pypi/v/crtime.svg?style=flat-square)](https://pypi.python.org/pypi/crtime/)
[![PyPI](https://img.shields.io/pypi/pyversions/crtime.svg?style=flat-square)](https://pypi.python.org/pypi/crtime/)
Get creation time of files for any platform and no external dependencies.
### Caveat
Linux requires sudo! There is no way to avoid this, as creation time is not exposed by the kernel.
It uses debugfs to mount the filesystem, as the information is actually contained on most linux platforms.
Speed: because it does one query for a whole directory, it is roughly 1000x faster than any other method (such as the `xstat` utility that can be found online).
### Installation
pip install crtime
### Usage
In a shell:
```bash
crtime .
# 1552938709\tfile_a.py
```
In Python
```python
from crtime import get_ctimes_in_dir
for fname, date in get_ctimes_in_dir(".", raise_on_error=True, as_epoch=False):
print(fname, date)
# file_a.py Mon Mar 18 20:51:18 CET 2019
```
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
crtime-0.0.1.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for crtime-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8c6a33eeaa9b9d318da95aa3d411e8ee55ce4b6fdb2715095df2b73fb62fad7 |
|
MD5 | 194e345120775531f7d5d27e9dc7c2bb |
|
BLAKE2b-256 | 2c80dca356df74948605edb89dbd7aa19da41783072f50944b03304bff9d56e2 |