19 lines
456 B
Python
19 lines
456 B
Python
import os
|
|
import random
|
|
|
|
OUTPUT_DIR = '/var/data'
|
|
NUM_FILES = 5
|
|
MAX_LINES = 100
|
|
MAX_VALUE = 1000
|
|
|
|
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
|
|
|
for i in range(NUM_FILES):
|
|
file_path = os.path.join(OUTPUT_DIR, f"file_{i}.txt")
|
|
with open(file_path, 'w') as f:
|
|
num_lines = random.randint(1, MAX_LINES)
|
|
for _ in range(num_lines):
|
|
f.write(f"{random.randint(1, MAX_VALUE)}\n")
|
|
|
|
print(f"Generated {NUM_FILES} files in {OUTPUT_DIR}.")
|