---
description: Clean all filenames in the directory
---

# Clean All Filenames

<figure><img src="https://407497632-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtwMQo2xj04EWlABw1SD7%2Fuploads%2F7D2NX539gLD8pcrVhUaz%2FScreenshot%202025-02-25%20at%201.47.42%E2%80%AFPM.png?alt=media&#x26;token=63acb62e-7fc5-4c62-8b53-fbb289400db1" alt=""><figcaption><p>Rename (Clean) Filenames</p></figcaption></figure>

Currently this function does 5 things to all files in a directory and any sub-directories.

1. Removes everything in parentheses with the exception of the 4-digit year (if available)
2. Removes `c2c`
3. Removes anything in brackets `[any text removed]` - along with the brackets
4. Removes any text / characters after "filename issue (year)"
5. Removes any extra spaces before the file extension

The pattern used for renaming is `{Series Name} {Issue Number} ({Year})`

[Mylar3](https://mylarcomics.com/) and [ComicRackCE](https://github.com/maforget/ComicRackCE) should be your first choice for performing these actions, but I wanted something I could easily run on my manual downloads directory or repair in a one-off method.

Oftentimes series archives or torrent files will have numerous naming patterns with information in parenthesis, brackets, before the year, after and all over the place. I continuously update these to handle as many as I encounter.

