Delete By File Name
Takes out files whose names are on a list: by default it copies everything else to the output, and in place it moves the listed files into the run folder instead of deleting them.
Delete By File Name matches each file name against a list you paste or load from a text file. In the default copy mode, every file that is not on the list is copied (verified by MD5) into the run's files folder with the same folder structure, and the input is untouched. Every file is reported as Copied or Excluded.
With Change files in place on, the matched files are moved out of the input folder into the run folder's removed folder, keeping their relative path. Nothing is destroyed, and every move can be undone from the report. A list of entries that matched nothing is written to not-found.csv, and the exact list used is saved as name-list.txt.
Use it when
- A set of documents has been withdrawn, clawed back or found privileged, and you have their file names or document IDs.
- You need a copy of a production or collection without certain named files.
- You need to remove every format of a document (PDF, native, text) by its ID.
How to run it
- Choose the folder as Input and an Output folder outside it.
- Paste the names into List, one per line, or choose a List file (or both).
- Choose Match: Exact, Stem or Contains.
- Leave Change files in place off to make a copy without the listed files; turn it on only to move them out of the input (you will be asked to confirm).
- Click Run.
- Read the notes, click Open report, and open
not-found.csv.
Settings
Every setting has the same help beside it in the app. On the command line, pass each as --name value; ltk help remove-by-name lists them.
Settings
| Setting | What it does | Type and default |
|---|---|---|
List--list |
File names to remove, one per line (paste from Excel is fine). Lines starting with # are ignored. Matching ignores letter case. One name per line; pasting a column from Excel works. Surrounding spaces and quotes are removed, blank lines and lines starting with # are ignored, and duplicates are dropped. Matching ignores letter case. An entry containing path characters (such as \ or :) is refused and listed in errors.csv: give names, not paths. |
text (lines) empty |
List file--list-file |
Optional text file with names, one per line. Combined with the list above. A plain text file with one name per line, added to anything typed in List. If the file cannot be found, the run stops. |
file empty |
Match--match |
How names are matched: Exact (full name with extension), Stem (name without extension, so every format of a document), or Contains (the name contains the entry; broadest, check the report). Exact: the full name with extension. Stem: the name without its extension (or the full name), so ABC0001 matches ABC0001.pdf and ABC0001.docx. Contains: the name contains the entry anywhere, so draft matches Contract draft v2.docx; this is the broadest and can catch more than intended. |
choice: Exact, Stem, ContainsExact |
Common settings
| Setting | What it does | Type and default |
|---|---|---|
Input required--input |
Folder (or single file) to read. It is opened read-only and never modified. | folder empty |
Output required--output |
Folder for reports. Must not be inside the input folder. Each run gets its own sub-folder. | folder empty |
Change files in place--in-place |
Off (default): changed copies are written to the output folder and the input is untouched. On: files in the input folder itself are renamed/moved, and every change is logged in the report. You will be asked to confirm. Matched files are moved to removed\<relative path> in the run folder. Their MD5 is recorded before the move, and every move is logged before and after it is made in in-place-journal.csv. To undo, move files back using OldPath and NewPath in the report. |
yes/nofalse |
Recurse--recurse |
Include sub-folders. | yes/notrue |
Extensions--extensions |
Only process these extensions (e.g. .pdf, .docx). Empty means the tool's default set. In copy mode, only files the run reads are copied. If you set Extensions, files with other extensions are left out of the copy altogether, not just left unmatched. |
list empty |
Parallelism--parallelism |
Files processed at once. Use 1-2 for spinning disks or network shares. | number4 |
What you get
Each run creates its own folder inside the output folder, with the report remove-by-name.csv, errors.csv and manifest.json (see Run folders and manifests).
files\…: Copy mode: every file not on the list, in the same folder structure.removed\…: In-place mode: the matched files, moved out of the input.remove-by-name.csv: Copy mode: one row per file. In place: one row per moved file. MatchedItem is the list entry that matched; Action, Status (Copied, Excluded, Removed or Error), OldPath, NewPath, MD5 and Message.not-found.csv: List entries that matched no file.name-list.txt: The cleaned list actually used, with the match mode and source.
Report columns
RelativePathFileNameMatchedItemOldPathNewPathActionStatusMD5Message
Check the result
- Read the note giving how many files matched the list.
- Open
not-found.csv: every entry there is a name the tool did not find, which may be a typo or a different extension (try Stem). - With Contains, filter the report on MatchedItem and check nothing was caught by mistake.
- Look at
errors.csvfor list lines that were refused.
- Use Stem with a list of document IDs to remove natives, PDFs and text files together.
- Keep
name-list.txtand the report with the matter as a record of what was removed and why.
- Despite its name, the tool never deletes files. In place it moves them into the run folder; delete that folder yourself only once you are sure.
- In place changes the evidence folder. Run in copy mode first and check the report before using it.
From the command line
The command line is part of LitTechKit Pro. See Command line.
ltk run remove-by-name --input "D:\Matter\Production" --output "D:\Matter\Clean" --list-file "D:\Matter\clawback.txt" --match Stem
Related tools
- Copy Files: Copies all files, or those matching a list of names or hashes, into a new folder with hash verification, preserved timestamps and a not-found report.
- Assign Document IDs: Renames files to document IDs in folder order: prefix + number (ABC0000001) or prefix/box/folder/page (ABC.5000.0001.0001), one number per document or per page. Report maps each ID to the original path and MD5. Copies by default, renames in place on request, or just previews.
- File Inventory: Lists every file with size, timestamps, attributes, hashes and detected file type, flagging extensions that don't match the content.