ShadowArch/UserScripts/standardize-folder

12 lines
293 B
Plaintext
Raw Normal View History

2016-11-09 22:25:00 -06:00
#!/bin/bash
export IFS="
"
export prefix="$(echo $PWD | rev | cut -f 1 -d '/' | rev)"
firstext="$(ls | head -n 1 | rev | cut -f 1 -d \. | rev)"
export count=1;
for i in $(ls -tr *."$firstext" | grep -v "$prefix"); do
mv "$i" "$prefix $count.$firstext"
export count=$(($count+1))
done