nws is a command-line utility written in C++ that replaces whitespaces with hyphens in filenames. It can process either a single file or all files in a directory (with optional file extension filtering).
- C++17 compatible compiler (GCC 8+, Clang 7+, or MSVC 2017+)
- CMake (optional, for build system)
- Clone the repository or download the source code
- Compile the program:
g++ -std=c++17 nws.cpp -o nwsOr with CMake:
mkdir build && cd build
cmake ..
cmake --build .- (Optional) Install system-wide:
sudo cp nws /usr/local/bin/Usage: nws [options]
Options:
--path, -p <directory> Specify target directory (required for batch processing)
--type, -t <extension> Filter files by extension (e.g., html, cpp)
--file, -f <filename> Process a single file
--help, -h Show this help message
Examples:
nws --path /path/files/ --type html
nws --file "archivo con espacios.cpp"
- Process all HTML files in a directory:
nws --path ./documents/ --type html- Process all files in a directory (regardless of extension):
nws --path ./downloads/- Process a single file:
nws --file "my document.txt"- Show help message:
nws --help- Processes files in bulk or individually
- Optional file extension filtering
- Preserves file extensions
- Reports all rename operations
- Handles errors gracefully (nonexistent files, permission issues, etc.)
Contributions are welcome! Please open an issue or pull request for any bugs or feature requests.