<#
.SYNOPSIS
Create test files in given directory
.DESCRIPTION
The script generates an x amount of text file based test file in the given folder. The files don't
contain any content.
.EXAMPLE
CreateTestFiles.ps1 -path c:\temp -amount 50
Create 50 files in c:\temp
.NOTES
Version: 1.0
Author: R. Mens - LazyAdmin.nl
Creation Date: 04 oct 2022
Modified Date:
Purpose/Change: Init
Link: https://lazyadmin.nl/powershell/powershell-scripting
#>
param(
[Parameter(
Mandatory=$true,
HelpMessage="Enter path were test files should be created")]
[string]$path,
[Parameter(
HelpMessage="How many files should be created"
)]
[int]$amount=10
)
# Create files
1..10 | ForEach-Object {
$newFile = "$path\test_file_$_.txt";
New-Item $newFile
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter