PowerShell script to generate realistic dummy file trees with random files for testing and automation.
  • PowerShell 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-01-24 16:27:44 +01:00
.gitattributes Initial commit 2026-01-24 16:19:17 +01:00
DummyFileTreeGenerator.ps1 Commited code 2026-01-24 16:27:14 +01:00
fileNames.csv Added csv files 2026-01-24 16:27:44 +01:00
files.csv Added csv files 2026-01-24 16:27:44 +01:00
folders.csv Added csv files 2026-01-24 16:27:44 +01:00
LICENSE Initial commit 2026-01-24 16:19:17 +01:00
README.md Commited code 2026-01-24 16:27:14 +01:00

DummyFileTreeGenerator

PowerShell script to generate realistic dummy file trees with random files for testing and automation.

Features

  • 📁 Creates realistic folder structures based on CSV templates
  • 📄 Downloads and distributes real files across the tree
  • 🎲 Randomizes file names by category (documents, images, videos, etc.)
  • Randomizes file timestamps (CreationTime, LastWriteTime, LastAccessTime)
  • 📦 Caches downloaded files to avoid repeated downloads
  • Supports appending to existing folder structures

Use Cases

  • Testing backup and sync solutions
  • Testing file system utilities
  • Creating demo/sample data
  • Performance testing with realistic file structures

Quick Start

# Basic usage - creates 100 files in ./DummyFiles
.\DummyFileTreeGenerator.ps1

# Custom target path with 500 files
.\DummyFileTreeGenerator.ps1 -MaxNumberOfFiles 500 -TargetPath "C:\TestData"

# Only include files larger than 5MB
.\DummyFileTreeGenerator.ps1 -MinFileSizeMB 5 -MaxNumberOfFiles 50

# Append to existing folder structure
.\DummyFileTreeGenerator.ps1 -AppendToExisting -TargetPath "C:\ExistingData"

Parameters

Parameter Default Description
-MinFileSizeMB 0 Minimum file size in MB
-MaxFileSizeMB 0 (unlimited) Maximum file size in MB
-MaxNumberOfFiles 100 Total number of files to generate
-MaxDepth 5 Maximum folder depth
-MaxFolders 5000 Maximum number of folders
-MaxFilesPerFolder 5 Maximum files per folder
-EmptyFolderPercentage 10 Percentage of folders left empty
-MaxTimestampDaysBack 365 Max days back for timestamp randomization
-TargetPath ./DummyFiles Target folder path
-AppendToExisting false Preserve existing folder and add new content

How It Works

  1. Downloads required CSV files (folders, files, fileNames) if not present
  2. Builds a folder structure based on the folder templates
  3. Downloads source files to a temp directory (cached for reuse)
  4. Copies and renames files to the target structure
  5. Randomizes timestamps on all created files

CSV File Formats

The script uses three CSV files (auto-downloaded if missing):

  • folders.csv - Folder path templates (column: Path)
  • files.csv - Source files (columns: fileName, fileSize, downloadLink, category)
  • fileNames.csv - Random file names by category (columns: category, fileName)

Requirements

  • PowerShell 5.1 or later
  • Internet connection (for initial CSV and file downloads)

License

MIT License - see LICENSE for details.