A Python script that generates random files and folders for backup testing. Supports local generation, remote generation directly on a server via SSH/SFTP, or both at once.
Python 3.6+ is required. For SSH support, install paramiko:
pip install paramiko
Generate files on your local machine:
python3 gen_data.py
python3 gen_data.py --output ~/test_data --size 100
python3 gen_data.py --output ~/test_data --total-mb 500Generate files directly on a remote server — nothing is written locally:
python3 gen_data.py --ssh user@host --remote-path /home/user/test_data
python3 gen_data.py --ssh user@host --port 2222 --remote-path /home/user/test_data --size 100
python3 gen_data.py --ssh user@host --remote-path /tmp/data --total-mb 200Generate locally and on the remote server in one run:
python3 gen_data.py --output ./local --ssh user@host --remote-path /tmp/data --size 50| Flag | Default | Description |
|---|---|---|
--output |
none | Local output directory. Omit to skip local generation. |
--size |
50 | Number of files to generate. |
--total-mb |
none | Target total size in MB. Overrides --size. |
--depth |
3 | Maximum folder nesting depth. |
--seed |
none | Random seed for reproducible output. |
--ssh |
none | Remote host in user@host format. |
--port |
22 | SSH port. |
--remote-path |
/tmp/test_data |
Path on the remote server to generate files in. |
--ssh-key |
none | Path to SSH private key. Falls back to agent/default keys. |
--password |
false | Prompt for SSH password instead of key auth. |
| Type | Extensions |
|---|---|
| Text | .txt .md .log .csv .json .xml .ini .yaml |
| Code | .py .sh .js .html .css |
| Binary | .bin .dat .db |
# 100 files locally
python3 gen_data.py --size 100 --output ~/test_data
# 1 GB directly on a remote server over SSH
python3 gen_data.py --ssh flame@192.168.1.10 --port 22 --remote-path /home/flame/test_data --total-mb 1024
# Reproducible run with a fixed seed
python3 gen_data.py --size 50 --seed 42 --output ~/test_data
# Remote with a specific key
python3 gen_data.py --ssh flame@192.168.1.10 --ssh-key ~/.ssh/id_ed25519 --remote-path /tmp/data --size 200
# Remote with password auth
python3 gen_data.py --ssh flame@192.168.1.10 --remote-path /tmp/data --password- Remote directories are created automatically if they don't exist.
- When using
--total-mb, a progress bar shows live MB written and file count. - When no
--outputor--sshis provided, defaults to generating 50 files in./test_data.