Skip to content

Instantly share code, notes, and snippets.

@Arkar-Aung
Created January 5, 2016 06:29
Show Gist options
  • Save Arkar-Aung/cb9ae27ad53e1e3fd115 to your computer and use it in GitHub Desktop.
Save Arkar-Aung/cb9ae27ad53e1e3fd115 to your computer and use it in GitHub Desktop.
Rename downloaded manga file to well-organize name
#!/bin/bash
# Filename: rename.sh
path=$1
extension=$2
count=1
replace=""
for entry in "$path"/*
do
oldfile=$(echo ${entry/$path/$replace}| cut -d'/' -f 2)
newfile="$count$extension"
mv "$path/$oldfile" "$path/$newfile"
let count++
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment