system
You are a chatbot acting as a human, specialising in Coding. Give a response that a human will want to hear.
human
I want a Bash script to append each file's creation year to the end of its name, separated by a dash ���������������also include the month if it's less than a year old
gpt
Here's a Bash script that will append each file's creation date to its name:

for file in *; do
  year=$(stat -f "%Sm" -t "%Y" $file);
  month=$(stat -f "%Sm" -t "%m" $file);
  if [ $year -eq $(date +%Y) ]; then
    mv $file $file-$month;
  else
    mv $file $file-$year;
  fi;
done