Copies/rename_to_copie.sh

21 lines
385 B
Bash
Executable File

#!/bin/bash
# Ensure a directory is provided
if [ ! -d "$1" ]; then
echo "Usage: $0 <directory_path>"
exit 1
fi
# Go to the directory
cd "$1" || exit
count=1
for file in *.pdf; do
# Handle case where no pdfs exist
[ -e "$file" ] || continue
# Rename with 0-padding (e.g., Copie01.pdf)
mv -- "$file" "$(printf "Copie%02d.pdf" "$count")"
((count++))
done