Skip to content

Instantly share code, notes, and snippets.

@sabinM1
Last active August 27, 2021 12:57
Show Gist options
  • Save sabinM1/86a06a0785b01842aa316f68ed22f779 to your computer and use it in GitHub Desktop.
Save sabinM1/86a06a0785b01842aa316f68ed22f779 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Forbid root rights
[ "$EUID" == "0" ] && echo -e "\e[91mDon't use sudo or root user to execute these scripts!\e[0m" && exit
export ALBUME="$PWD/albums.txt"
: > "$ALBUME" # clear (and create) file
for dir in ./*/
do cd -P "$dir" || continue
printf %s\\n "$PWD" >&2
echo -e "${PWD##*/}\n" >> "$ALBUME" && \ls -lha | cut -d " " -f 12-99 | grep -E '[0-9][0-9]' | sed 's/.flac//g' >> "$ALBUME" && echo -e "\n" >> "$ALBUME" && cd "$OLDPWD" ||
! break; done || ! cd - >&2
echo
#!/bin/bash
# Forbid root rights
[ "$EUID" == "0" ] && echo -e "\e[91mDon't use sudo or root user to execute these scripts!\e[0m" && exit
export ALBUME="$PWD/albums.txt"
: > "$ALBUME" # clear (and create) file
for dir in ./*/
do cd -P "$dir" || continue
printf %s\\n "$PWD" >&2
echo -e "[spoiler=${PWD##*/}]\n[img=right]torrent_IDHERE_pic_NR.jpg[/img]\n[b]Tracklisting:[/b]\n" >> "$ALBUME" && \ls -lha | cut -d " " -f 12-99 | grep -E '[0-9][0-9]' | sed 's/.flac//g' >> "$ALBUME" && echo -e "\n[b]Duration:[/b] hh:mm:ss\n[/spoiler]\n" >> "$ALBUME" && cd "$OLDPWD" ||
! break; done || ! cd - >&2
echo
#!/bin/bash
# Forbid root rights
[ "$EUID" == "0" ] && echo -e "\e[91mDon't use sudo or root user to execute these scripts!\e[0m" && exit
export ALBUME="$PWD/albums.txt"
: > "$ALBUME" # clear (and create) file
for dir in ./*/
do cd -P "$dir" || continue
printf %s\\n "$PWD" >&2
echo -e "[spoiler=${PWD##*/}]\n[b]Tracklisting:[/b]\n" >> "$ALBUME" && \ls -lha | cut -d " " -f 12-99 | grep -E '[0-9][0-9]' | sed 's/.flac//g' >> "$ALBUME" && echo -e "\n[/spoiler]\n" >> "$ALBUME" && cd "$OLDPWD" ||
! break; done || ! cd - >&2
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment