#!/bin/bash

cd /var/www/zamyatin/content || exit 1

for file in *.txt; do
  safe_name=$(echo "$file" \
    | sed 's/ /_/g' \
    | sed 's/#/номер_/g' \
    | sed 's/:/_/g' \
    | sed 's/–/_/g' \
    | sed 's/-/_/g')

  if [[ "$file" != "$safe_name" ]]; then
    echo "📁 $file → $safe_name"
    mv "$file" "$safe_name"
  fi
done
