Files
tool__scripts/auto-curler/file-replicator.sh
2026-07-09 01:05:56 +02:00

31 lines
605 B
Bash
Executable File

#!/bin/bash
SOURCE_DIR="output"
TARGET_DIR="target"
replicate_structure() {
local source="$1"
local target="$2"
for item in "$source"/*; do
if [ -d "$item" ]; then
local dir_name=$(basename "$item")
mkdir -p "$target/$dir_name"
replicate_structure "$item" "$target/$dir_name"
elif [ -f "$item" ]; then
if [ -s "$item" ]; then
local file_name=$(basename "$item")
touch "$target/$file_name"
fi
fi
done
}
replicate_structure "$SOURCE_DIR" "$TARGET_DIR"
echo "Replication complete from $SOURCE_DIR to $TARGET_DIR"