zipseq file type mix handling
This commit is contained in:
@@ -1029,21 +1029,35 @@ def run_zip(requested_workers: int | None, *, verbose: bool) -> int:
|
||||
# If .7z archive exists and we have stored state, do quick check before computing full state
|
||||
if zip_path.exists() and stored_state is not None:
|
||||
# Quick check: if directory mtime is older than archive, likely unchanged
|
||||
# But first verify that all files in stored state still exist (catches deletions)
|
||||
try:
|
||||
dir_mtime = seq_dir.stat().st_mtime_ns
|
||||
archive_mtime = zip_path.stat().st_mtime_ns
|
||||
# If directory wasn't modified since archive was created, skip state computation
|
||||
if dir_mtime <= archive_mtime:
|
||||
quick_skipped += 1
|
||||
if quick_skipped <= 5:
|
||||
log("scan", f"Skipping {rel} (unchanged since archive)")
|
||||
# Still need to check for old .zip cleanup (we have .7z, so .zip is obsolete)
|
||||
if old_zip_path and old_zip_path.exists():
|
||||
old_zip_path.unlink(missing_ok=True)
|
||||
old_state_path = state_path_for(old_zip_path)
|
||||
if old_state_path.exists():
|
||||
old_state_path.unlink(missing_ok=True)
|
||||
continue
|
||||
# Quick check: verify stored files still exist (catches file deletions)
|
||||
stored_files_exist = True
|
||||
for entry in stored_state.get("files", []):
|
||||
# Skip Thumbs.db entries (they're filtered out anyway)
|
||||
if Path(entry.get("path", "")).name.lower() == "thumbs.db":
|
||||
continue
|
||||
file_path = seq_dir / entry["path"]
|
||||
if not file_path.exists():
|
||||
stored_files_exist = False
|
||||
break
|
||||
|
||||
# Only do mtime check if all stored files still exist
|
||||
if stored_files_exist:
|
||||
dir_mtime = seq_dir.stat().st_mtime_ns
|
||||
archive_mtime = zip_path.stat().st_mtime_ns
|
||||
# If directory wasn't modified since archive was created, skip state computation
|
||||
if dir_mtime <= archive_mtime:
|
||||
quick_skipped += 1
|
||||
if quick_skipped <= 5:
|
||||
log("scan", f"Skipping {rel} (unchanged since archive)")
|
||||
# Still need to check for old .zip cleanup (we have .7z, so .zip is obsolete)
|
||||
if old_zip_path and old_zip_path.exists():
|
||||
old_zip_path.unlink(missing_ok=True)
|
||||
old_state_path = state_path_for(old_zip_path)
|
||||
if old_state_path.exists():
|
||||
old_state_path.unlink(missing_ok=True)
|
||||
continue
|
||||
except OSError:
|
||||
# If stat fails, fall through to full state computation
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user