mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
feat: Rename old indexes at the end of init process
This commit is contained in:
parent
7fc9b7d456
commit
f397634dd2
1 changed files with 10 additions and 0 deletions
|
@ -4,6 +4,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
from typing import Dict, List, Optional, Iterable, IO, Union
|
from typing import Dict, List, Optional, Iterable, IO, Union
|
||||||
from crontab import CronTab, CronSlices
|
from crontab import CronTab, CronSlices
|
||||||
|
@ -387,6 +388,15 @@ def init(force: bool=False, out_dir: Path=OUTPUT_DIR) -> None:
|
||||||
print(' For more usage and examples, run:')
|
print(' For more usage and examples, run:')
|
||||||
print(' archivebox help')
|
print(' archivebox help')
|
||||||
|
|
||||||
|
json_index = Path(out_dir) / JSON_INDEX_FILENAME
|
||||||
|
html_index = Path(out_dir) / HTML_INDEX_FILENAME
|
||||||
|
index_name = f"{date.today()}_index_old"
|
||||||
|
if json_index.exists():
|
||||||
|
json_index.rename(f"{index_name}.json")
|
||||||
|
if html_index.exists():
|
||||||
|
html_index.rename(f"{index_name}.html")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@enforce_types
|
@enforce_types
|
||||||
def status(out_dir: Path=OUTPUT_DIR) -> None:
|
def status(out_dir: Path=OUTPUT_DIR) -> None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue