Skip to content

Instantly share code, notes, and snippets.

@rey
Created September 14, 2023 12:58
Show Gist options
  • Select an option

  • Save rey/e58d808ac38e4f1fa0c17e3cbb32c6eb to your computer and use it in GitHub Desktop.

Select an option

Save rey/e58d808ac38e4f1fa0c17e3cbb32c6eb to your computer and use it in GitHub Desktop.

Revisions

  1. rey created this gist Sep 14, 2023.
    44 changes: 44 additions & 0 deletions rename-files-in-a-folder.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    # ------------------------------------------------------------------------------------------------------------------------------------------

    # 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