INNER CODE UNIT · Python
get_html_files
netkiller/netkiller.github.io · generate_sitemaps.py:12
def get_html_files():
"""Recursively find all HTML files."""
html_files = []
for root, dirs, files in os.walk(OUTPUT_DIR):
for file in files:
if file.endswith('.html'):
full_path = Path(root) / file
rel_path = full_path.relative_to(OUTPUT_DIR)
html_files.append(rel_path)
return sorted(html_files)
def get_lastmod(filepath):
"""Get last modification date of a file."""
mtime = os.path.getmtime(filepath)
return datetime.fromtimestamp(mtime).strftime('%Y-%m-%d')
def url_encode_path(path):
"""URL encode a file path."""