Skip to content

Instantly share code, notes, and snippets.

@rey
Created September 14, 2023 12:58
Show Gist options
  • Save rey/e58d808ac38e4f1fa0c17e3cbb32c6eb to your computer and use it in GitHub Desktop.
Save rey/e58d808ac38e4f1fa0c17e3cbb32c6eb to your computer and use it in GitHub Desktop.
Quick and dirty script to run in a folder of files you want to rename
# ------------------------------------------------------------------------------------------------------------------------------------------
# This file is called 2018-02-02-932.md
# ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# ---
# layout: link
# title:
# link:
# ---
# [Spotify Adds Songwriter and Producer Credits](https://pitchfork.com/news/spotify-adds-songwriter-and-producer-credits)
# I've always wished iTunes did this -- _or do they?_ -- they must have this information.
# ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
# @Edit: 2018-02-02-spotify-adds-creds.md
# okay let's rename this to 2018-02-02-spotify-adds-creds.md
# 2018-02-02-spotify-adds-creds.md
#! /bin/bash
for file in *; do
echo
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo
echo "This file is called ${file}"
echo
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' ↓
echo
cat ${file}
echo
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' ↑
echo
read -e -p "Edit: " -i "${file}" fileNewName
echo "okay let's rename this to ${fileNewName}"
mv ${file} done/${fileNewName}
stat -f ${fileNewName}
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment