Created
January 5, 2016 06:29
-
-
Save Arkar-Aung/cb9ae27ad53e1e3fd115 to your computer and use it in GitHub Desktop.
Rename downloaded manga file to well-organize name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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