first commit
[scripts.git] / vidnum
blob8f247a2adfd6df9eb8a7c559a5d195011747cd0a
1 #!/bin/bash
2 echo "This script is designed to rename a whole season of videos in one go!"
3 ls -lh
4 echo "What extension do the videos have?(ignoring the dot)"
5 read extension
6 echo "What season are the videos?"
7 read ans
8 echo
9 echo "You are about to rename the files to:"
11 if [ "$ans" -lt 10 ]; then season="0""$ans"; else season="$ans"; fi
13 # list the videos and what they will be renamed to
14 epiNum=0
15 for i in *."$extension"; do
16 let epiNum=epiNum+1
17 if [ "$epiNum" -lt 10 ]; then
18 echo "$i" " --> " "S$season""E0$epiNum"" - .$extension"
19 else
20 echo "$i" " --> " "S$season""E$epiNum"" - .$extension"
22 done
24 # Asks for confirmation for renaming
25 loop=1
26 while [ $loop ]; do
27 echo "Are you sure?(y/n)"
28 read ans2
30 if [ $ans2 = 'y' ]; then
31 epiNum=0
32 for i in *."$extension"; do
33 let epiNum=epiNum+1
34 if [ "$epiNum" -lt 10 ]; then
35 mv "$i" "S$season""E0$epiNum"" - .$extension"
36 else
37 mv "$i" "S$season""E$epiNum"" - .$extension"
39 done
40 exit
41 elif [ $ans2 != 'n' ]; then
42 echo "Please enter either y or n !"
43 else
44 echo "Exiting.."
45 exit
47 done