#!/bin/bash # Set the source and destination directories src_dir="./emojis_categorized" dest_dir="../emojis" # Navigate to the source directory cd "$src_dir" || exit # Find all files in subdirectories and loop through them find . -type f -not -path '*/\.*' -print0 | while IFS= read -r -d $'\0' file; do # build the new filename filename=$(echo "$file" | sed 's/\//+/g' | sed 's/^.+/..\/emojis\//g') echo "$filename" echo "$file" # # Copy the file to the destination directory with the new filename cp "$file" "$filename" done # echo "Flat folder creation complete!"