add new migrate_data step to move old folder
This commit is contained in:
parent
9c56848645
commit
aa5a674a17
2 changed files with 12 additions and 0 deletions
archiver
|
@ -7,6 +7,7 @@ import os
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from subprocess import run
|
||||
|
||||
from parse import parse_links
|
||||
from links import validate_links
|
||||
|
@ -29,6 +30,7 @@ from util import (
|
|||
progress,
|
||||
cleanup_archive,
|
||||
pretty_path,
|
||||
migrate_data,
|
||||
)
|
||||
|
||||
__AUTHOR__ = 'Nick Sweeting <git@nicksweeting.com>'
|
||||
|
@ -124,6 +126,8 @@ if __name__ == '__main__':
|
|||
print_help()
|
||||
raise SystemExit(0)
|
||||
|
||||
migrate_data()
|
||||
|
||||
source = sys.argv[1] if argc > 1 else None # path of links file to import
|
||||
resume = sys.argv[2] if argc > 2 else None # timestamp to resume dowloading from
|
||||
|
||||
|
|
|
@ -360,6 +360,14 @@ def fix_folder_path(archive_path, link_folder, link):
|
|||
run(['rm', '-R', source])
|
||||
|
||||
|
||||
def migrate_data():
|
||||
# migrate old folder to new OUTPUT folder
|
||||
old_dir = os.path.join(REPO_DIR, 'html')
|
||||
if os.path.exists(old_dir):
|
||||
print('[!] WARNING: Moved old output folder "html" to new location: {}'.format(OUTPUT_DIR))
|
||||
run(['mv', old_dir, OUTPUT_DIR], timeout=10)
|
||||
|
||||
|
||||
def cleanup_archive(archive_path, links):
|
||||
"""move any incorrectly named folders to their canonical locations"""
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue