A collection of useful PowerShell scripts developed by Franz.Agency to automate common tasks and improve workflow efficiency.
You can clone this repository using the following command:
git clone https://github.com/franz-agency/powershell.git
Alternatively, you can download individual scripts directly from the repository.
Converts line endings of files from Windows-style (CRLF) to Unix-style (LF) format, useful for cross-platform development.
- Recursively processes files in a directory and its subdirectories
- Filters by file extensions
- Excludes directories that start with a dot (.)
- Supports dry run mode to preview changes without modifying files
- Provides detailed statistics about the conversion process
# Perform a dry run (no changes made)
.\convert_line_ending.ps1 -Path "C:\Projects" -Extensions "txt,md,js" -DryRun "yes"
# Perform actual conversion
.\convert_line_ending.ps1 -Path "C:\Projects\Website" -Extensions "html,css,js" -DryRun "no"
# Run with verbose output
.\convert_line_ending.ps1 -Path "C:\Projects" -Extensions "js,html" -DryRun "yes" -Verbose
A utility script that formats time spans in a human-readable way. Useful for reporting execution times of scripts or processes.
- Formats durations into human-readable strings
- Automatically adjusts output format based on the duration length (milliseconds, seconds, minutes, hours)
- Uses grammatically correct pluralization
- Can be integrated into other scripts to report execution times
# Basic usage with default task name
$timeSpan = [TimeSpan]::FromSeconds(125)
Format-TimeSpan -timeSpan $timeSpan
# Custom task name
Format-TimeSpan -timeSpan $timeSpan -taskName "Database backup"
# Measuring and reporting actual execution time
$time = Measure-Command { YourScriptOrCommand }
Format-TimeSpan -timeSpan $time -taskName "The operation"
Combines the content of all files from a specified directory and its subdirectories into a single output file. Useful for code reviews, documentation, or sharing multiple files as a single document.
- Processes all files in a directory tree
- Clearly separates each file's content with a header showing its relative path
- Preserves the original content formatting
- Supports both absolute and relative paths
- Checks for existing output files with confirmation prompt
- Provides option to force overwrite without prompting
- Offers optional timestamp addition to output filenames
# Basic usage with absolute paths
.\makeonefile.ps1 -SourceDirectory "C:\Projects\MyCode" -OutputFile "C:\Temp\combined_code.txt"
# Using relative paths
.\makeonefile.ps1 -SourceDirectory ".\src" -OutputFile "combined_src.txt"
# Automatically overwrite existing file without prompting
.\makeonefile.ps1 -SourceDirectory ".\src" -OutputFile "combined_src.txt" -Force
# Add timestamp to output filename (e.g., combined_src_20250515_102030.txt)
.\makeonefile.ps1 -SourceDirectory ".\src" -OutputFile "combined_src.txt" -AddTimestamp
# Using variables with both Force and AddTimestamp parameters
$srcDir = "D:\Projects\WebApp"
$outputPath = "D:\Documentation\WebApp_Full_Source.txt"
.\makeonefile.ps1 -SourceDirectory $srcDir -OutputFile $outputPath -Force -AddTimestamp
Translates the names of directories and subdirectories in a specified directory using the DeepL API. Useful for creating multilingual versions of file structures.
- Translates directory names using DeepL's high-quality translation
- Supports multiple language pairs
- Offers a dry run mode to preview changes
- Excludes hidden directories (starting with a dot)
- Reports detailed statistics about translated directories
# Dry run to preview changes
.\translate_directories.ps1 -Directory "C:\Projects\Website" -SourceLang "EN" -TargetLang "DE" -DryRun
# Actual translation
.\translate_directories.ps1 -Directory "C:\Projects\Website" -SourceLang "EN" -TargetLang "DE"
There is no way to automatically revert the directory renaming. Always keep a backup before running this script in non-dry-run mode. Test first with small test directories.
A utility script to test the DeepL API translation functionality. Useful for verifying API keys and testing translation quality before using the translation in other scripts.
- Tests connectivity to the DeepL API
- Handles API key validation
- Demonstrates proper usage of the DeepL API for translation
- Includes example translations with special characters
# Run the script to test translation functionality
.\test_translation.ps1
Some scripts in this collection (translate_directories.ps1
and test_translation.ps1
) use the DeepL API to perform translations. To use these scripts, you'll need a DeepL API key.
- Sign up for a DeepL API account at DeepL Pro
- Choose a plan (free trial or paid)
- Obtain your API key from the account dashboard
- Create a
config.ini
file in the repository root (you can copy fromconfig.ini.template
) - Add your API key to the file:
API_KEY = "your-api-key-here"
Contributions are welcome! If you have improvements or additional scripts to share, please:
- Fork the repository
- Create a new branch for your feature
- Add your script with proper documentation
- Submit a pull request
Please ensure all scripts include proper comment-based help and documentation.
These scripts are provided under the MIT License. See the LICENSE file for details.