Skip to content

Commit

Permalink
Update so it tracks recent time var instead of oldest
Browse files Browse the repository at this point in the history
  • Loading branch information
cehune committed Feb 8, 2025
1 parent cef3c2c commit 5a91b58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "file_auto_expiry"
version = "0.0.11"
version = "0.0.12"
description = "WATCloud project containing scripts to check if directories / files are expired"
readme = "README.md"
requires-python = ">=3.7, <4"
Expand Down
6 changes: 3 additions & 3 deletions src/file_auto_expiry/utils/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def collect_expired_file_information(folder_path, save_file, scrape_time, expiry
for path, is_expired, creators, atime, ctime, mtime in scan_folder_for_expired(
folder_path, expiry_threshold, check_folder_atime):
# handles generating the dictionary
oldest_time = min(datetime.datetime.fromtimestamp(atime), datetime.datetime.fromtimestamp(ctime));
oldest_time = min(oldest_time, datetime.datetime.fromtimestamp(mtime))
days_unused = (datetime.datetime.now() - oldest_time).days
recent_time = max(datetime.datetime.fromtimestamp(atime), datetime.datetime.fromtimestamp(ctime));
recent_time = max(recent_time, datetime.datetime.fromtimestamp(mtime))
days_unused = (datetime.datetime.now() - recent_time).days
path_info[path] = {
"path": path, # storing pathname so we keep it when we transfer the dictionary to jsonl
"creators": [creator for creator in creators if isinstance(creator[1], int) and creator[1] > 0 and creator[1] == creator[2]],
Expand Down

0 comments on commit 5a91b58

Please sign in to comment.