
Plan Folders with File List Tidy
Turn filenames into a proposed folder plan and an old-name to new-name map. #생산성
Turn filenames into a proposed folder plan and an old-name to new-name map.
See unknown entries and name collisions before deciding; the tool does not open, move, or rename files.
File List Tidy
Paste one filename per line and get a proposed folder plus an old-name → new-name map. It creates a plan only; it never opens, moves, or renames the named files.
What you send → what you get
Send a UTF-8 list of filenames and choose a sorting criterion. Get a folder proposal, a rename map, explicit unknown entries, and a list of name collisions.
Five useful controls
- Input:
--input FILEor-reads a file list or standard input. - Criterion:
type,year, orprojectgroups by recognized file type, detected year, or a repeated filename prefix. - Output format:
markdown,csv, orjsonfor a human or machine readable mapping. - Output destination:
--output FILEor-saves a report or prints it. - Collision review: always included; it shows proposed names that repeat in Markdown, CSV, and JSON, and no automatic suffix is added.
Examples
python3 scripts/file_list_tidy.py --input examples/names.txt
python3 scripts/file_list_tidy.py --input examples/names.txt --criterion year --format csv --output plan.csv
cat examples/names.txt | python3 scripts/file_list_tidy.py --input - --format json
The package includes an example list and its expected Markdown output.
How names are read
- Year. A four-digit 1900–2099 token, or the leading year of a compact date (
YYYYMMDD,YYYYMMDDhhmmss) or a separated date (YYYY-MM-DD,YYYY-MMDD). A six-digit token that could be eitherYYYYMMorYYMMDDis ambiguous and is reported asunknown, not as a year. A fiscal range such as2023-2024resolves to its starting year (2023). Version strings (v1.2024.3, any of._-between parts) and phone-number groups (1999-1234,090-1234-5678) are not years. Only ASCII digits count; full-width digits are folded to ASCII first, but Arabic-Indic digits are never read as a year. - Project. The first filename segment (split on spaces,
_,.,-), compared after NFKC folding soACME,acme, andACMEgroup together. The folder uses the NFKC-normalized spelling of the first leader seen. Symbols are ignored when leaders are compared, and paths are compared by basename. A leader that is empty, purely numeric, or date-shaped (001,20240512,2024-01-01) carries no project name and becomesunknown. A segment must occur in at least two distinct filenames; a name listed twice is counted once.
Output and encoding
- Markdown: the original name is preserved as listed (NFC); shown in the rename map and
unknownlist. - CSV: a
'is prepended to any field starting with=,+,-, or@(spreadsheet formula guard), so thoseold_namevalues differ from the raw name. - JSON: the original name is preserved as listed (NFC).
In every format, names are normalized to NFC (so NFD and NFC spellings match), a byte-order mark anywhere in a name is removed, and the project comparison also folds full-width forms to ASCII.
Requirements
Python 3.9 or newer. Input is UTF-8, optionally with a UTF-8 BOM. UTF-16, legacy encodings, empty lists, unreadable paths, inputs over 200,000 bytes, more than 5,000 nonblank filename lines (terminal newline and blank lines do not count), and inputs containing a NUL byte are rejected with one error: line and exit code 2. Filenames without a strong type or year signal are assigned to unknown. Names over 255 characters are reported as unknown with reason too long (shown in Markdown, CSV, and JSON), and processing continues. If stdout cannot encode a name, the tool recommends --output FILE with one error line. Existing output files, dangling symlinks, symlink loops in listed paths, and output paths matching listed filenames are refused with one error line. A closed stdout pipe exits cleanly. New output files are written through a temporary file with atomic replacement and take the usual umask-derived permissions.
Tests
Run from the package directory:
python3 -m unittest discover tests


