mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 19:23:10 +02:00
- Move all linux_configuration scripts into two semantic categories: - single_use/: scripts run once manually (fresh install, fixes, setup) - periodic_background/: scripts run by systemd timers or daemons - Preserve existing subdirectory structure within each category - Fix lib/common.sh source paths for new directory depths - Fix CONFIG_DIR depth in setup_periodic_system.sh and check_and_enable_services.sh - Update all references in tests, fresh-install/main.sh, nix modules, and docs - Fix check_polling_antipatterns.sh false positives (||, regex |, case patterns, jq strings) - Fix pre-existing mypy exclusion path and type annotations for moved tools/ directory - Rewrite check_polling_antipatterns.sh using awk (no bash regex loops); add require_serial: true
29 lines
805 B
Bash
Executable File
29 lines
805 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Get the list of directories in the current script directory
|
|
mapfile -t directories < <(find . -maxdepth 1 -type d ! -name . -printf '%f\n')
|
|
|
|
# Check if there is exactly one directory
|
|
if [ ${#directories[@]} -ne 1 ]; then
|
|
echo "Error: There should be exactly one folder in the current directory."
|
|
exit 1
|
|
fi
|
|
|
|
# Get the name of the single directory
|
|
folder_name=${directories[0]}
|
|
|
|
random_string() {
|
|
local length="$1"
|
|
tr -dc 'a-zA-Z0-9!@#$%^&*()_+{}|:<>?~' < /dev/urandom | head -c "$length"
|
|
}
|
|
|
|
# Number of copies to create (default 100)
|
|
num_copies="${1:-100}"
|
|
|
|
# Create the specified number of copies
|
|
for ((i = 1; i <= num_copies; i++)); do
|
|
new_folder_name="$(random_string 255)"
|
|
cp -r "$folder_name" "$new_folder_name"
|
|
echo "Folder copied and renamed to '$new_folder_name'"
|
|
done
|