custom-scripts/create-dummy-files.sh

26 lines
854 B
Bash
Raw Normal View History

2024-06-23 19:43:51 +00:00
#!/bin/bash
# Configuration variables
TARGET_DIR="." # Directory where files will be created
FILE_EXTENSIONS=("JPG" "MP4" "DNG") # Array of file extensions
NUM_FILES=25 # Number of files to create for each extension
FILE_SIZE=10000 # Size of each file in bytes
# Function to create a single dummy file
create_dummy_file() {
local file_path="$1"
head -c "$FILE_SIZE" </dev/urandom > "$file_path"
}
# Iterate over each file extension and create the dummy files
for ext in "${FILE_EXTENSIONS[@]}"; do
for ((i=1; i<=NUM_FILES; i++)); do
file_name="dummy_file_${i}.${ext}"
file_path="$TARGET_DIR/$file_name"
create_dummy_file "$file_path"
echo "Created file: $file_path"
done
done
echo "Created $NUM_FILES dummy files for each extension in $TARGET_DIR"