This project is a powerful file renaming tool written in C#. It's capable of renaming all files in a given directory according to user-specified criteria, including removing spaces, parentheses, special characters, and numbers.
This project requires .NET Core to run:
-
Download the .NET SDK (Software Development Kit): https://dotnet.microsoft.com/download
-
Install the .NET SDK by following the instructions specific to your operating system.
After .NET is installed, you can run this application using Visual Studio Code or any other IDE of your choice that supports .NET development.
You can pass in arguments to the program as follows:
file-renamer-pro -p [path] -n [prepend] -a [append] -f [filter] --keep-case
Here is the explanation of the arguments:
-p [path]
: Path to the files to be renamed.-n [prepend]
: Name to prepend to the filename.-a [append]
: Name to append to the filename.-f [filter]
: Amount of filtering used in renaming files:0
= Removes only spaces1
= Removes spaces and parentheses (DEFAULT)2
= Removes spaces and all special characters3
= Removes all numbers4
= Generates a GUID as filename
--keep-case
: This flag will keep the case of the file name.
Command | Description |
---|---|
file-renamer-pro -p {path} |
Specify a path; if not provided, you'll be prompted to enter one |
file-renamer-pro -f {0, 1, 2, 3, 4} |
Select a renaming filter |
file-renamer-pro -n {name} |
Prepend a custom text to the file name |
file-renamer-pro -a {name} |
Append a custom text to the file name |
file-renamer-pro --keep-case |
Use this flag to maintain the original file name's case |
file-renamer-pro -p c:\myfolder\assets
This command renames all files within myfolder\assets
using the default renaming filter.
file-renamer-pro -f 2 -p c:\myfolder\assets
This command renames all files within myfolder\assets
, removing all special characters.
Here is what each filter level does:
Filter Command | Description |
---|---|
file-renamer-pro -f 0 |
Removes all spaces |
file-renamer-pro -f 1 |
Removes all spaces and parentheses (default) |
file-renamer-pro -f 2 |
Removes all spaces and special characters |
file-renamer-pro -f 3 |
Removes all numbers |
file-renamer-pro -f 4 |
Renames all files as GUIDs |
file-renamer-pro -f 3 -n hi_ -p c:\myfolder\assets
This command renames all files within myfolder\assets
, removing all numbers. All file names are prepended with "hi_" (e.g., hi_testImage.png).
file-renamer-pro -f 3 -a _bye -p c:\myfolder\assets
This command renames all files within myfolder\assets
, removing all numbers. All file names are appended with "_bye" (e.g., testImage_bye.png).
This project uses NUnit for testing. To run the tests, you'll first need to install the NUnit and Microsoft.NET.Test.Sdk NuGet packages:
- Open a terminal and navigate to the directory where your test project is located.
- Run the following commands:
dotnet add package NUnit
dotnet add package Microsoft.NET.Test.Sdk
dotnet add package NUnit3TestAdapter
To run the tests, simply navigate to the root directory of the project in your terminal and execute the dotnet test
command.
Contributions are welcome! Please feel free to submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.