diff --git "a/\n" "b/\n" new file mode 100644 index 0000000..e69de29 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dcfbbe6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +test-dir diff --git a/DummyFileCreater.sh b/DummyFileCreater.sh new file mode 100644 index 0000000..f03359d --- /dev/null +++ b/DummyFileCreater.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Created to on 20231009 to make dummy files for testing the mass_rename script +mkdir test-dir 2>/dev/null +cd test-dir +cat ../list.txt |while read -r line +do echo -e $line +touch "$line" +done diff --git a/README.md b/README.md index 1fab7f6..eed9031 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,24 @@ -# mass_rename -This BASH script is for mass renaming and moving of files. - -### Why this maybe useful -Need to rename media files for use in an application such as; PLEX, Jellyfin, etc.. -Want torename picuture from trip so you can group them together - -Basic code -``` -ls | while read line -do echo $line -mv "$line" "$(echo -e "$line" |sed -e 's///' -e 's///' )" -done -``` -This will subsittute the oldname for the new name. +# mass_rename +This BASH script is for mass renaming and moving of files. + +### Why this maybe useful +Need to rename media files for use in an application such as; PLEX, Jellyfin, etc.. +Want torename picuture from trip so you can group them together + +Basic code +``` +ls | while read line +do echo $line +mv "$line" "$(echo -e "$line" |sed -e 's///' -e 's///' )" +done +``` +This will subsittute the oldname for the new name. + + +### Script is for making the dummy files for testing the mass_rename script (DummyFileCreater.sh) +``` +cat list.txt |while read line +do echo $line +touch "$line" +done +``` \ No newline at end of file diff --git a/list.txt b/list.txt new file mode 100644 index 0000000..53520ae --- /dev/null +++ b/list.txt @@ -0,0 +1,13 @@ +WordGirl - 1x01 - Tobey or Consequences High Fat Robbery.mp4 +WordGirl - 1x02 - You Cant Crush City Hall Two Brain Highway.mp4 +WordGirl - 1x03 - Coupon Madness When Life Gives You Potatoes.mp4 +WordGirl - 1x04 - Jerky Jerk Becky's Birthday.mp4 +WordGirl - 1x05 - Chuck Down With Word Up.mp4 +WordGirl - 1x06 - Book Ends Mr. Big.mp4 +WordGirl - 1x07 - Super Grounded Mouse Army.mp4 +WordGirl - 1x08 - Tobey's Masterpiece Chuck the Nice Pencil Selling Guy.mp4 +WordGirl - 1x09 - The Birthday Girl Granny Sitter.mp4 +WordGirl - 1x10 - Mr. Big's Big Plan Vocab Bee.mp4 +WordGirl - 1x11 - Shrinkin in the Ray Department Store Tobey.mp4 +WordGirl - 1x12 - Chuck E Sneeze Swap Meat.mp4 +WordGirl - 1x13 - Granny's Good Time All Cure Spritzer Mecha Mouse.mp4 diff --git a/mass_rename.sh b/mass_rename.sh index 7b39fc2..5f96286 100644 --- a/mass_rename.sh +++ b/mass_rename.sh @@ -3,11 +3,15 @@ # Created on 20231001 ### Basic Script +echo -e "This script renames a group of files" +read -p "Where are the files located?: " FL +read -p "Please input what you don't want: " remove +read -p "Please input what you want to add: " add ls | while read line do echo $line # can use cp instead -mv "$line" "$(echo -e "$line" |sed -e 's///' -e 's///' )" +mv $FL/"$line" "$(echo -e "$FL/$line" |sed -e "s/$remove/$add/" )" done # can use path -#mv "$line" "/Users//Dowloads/$(echo -e "$line" |sed -e 's///' -e 's///' )" +#mv "$line" "/Users//Dowloads/$(echo -e "$line" |sed -e 's/$remove/$add/' -e 's///' )" diff --git a/mass_rename.sh.bk b/mass_rename.sh.bk new file mode 100644 index 0000000..09b07c5 --- /dev/null +++ b/mass_rename.sh.bk @@ -0,0 +1,50 @@ +#!/bin/bash +# This script is for doing mass renamaning of media files. +# Created on 20231001 + +clear + +### Funtions +PDIR(){ +read -p "Where the files located?: " files +cd "$files" +echo -e "\nAre these the files you want to rename?\n$(pwd)/\n$(ls)" +case $YN in + Y|y|yes) echo "yes" ;; + N|n|[Nn]o) echo "Try again" ;; +esac +read -p "Is this correct? (Y/N): " YN +} + +# Data Collection +#read -p "Where the files located?: " files +#cd "$files" + +#echo -e "\nAre these the files you want to rename?\n$(pwd)/\n$(ls)" + +#read -p "Is this correct? (Y/N): " YN +#echo -e "$YN" + +#case $YN in +# Y|y|yes) echo "yes" +# ;; +# N|n|[Nn]o) echo "Try again" +# ;; +#esac + +### Basic Script +#case $choice in + +#ls | while read line +#do echo $line +## can use cp instead +#mv "$line" "$(echo -e "$line" |sed -e 's///' -e 's///' )" +#done + +# can use path +#mv "$line" "/Users//Dowloads/$(echo -e "$line" |sed -e 's///' -e 's///' )" + +while true +do + PDIR +done diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..449594e --- /dev/null +++ b/notes.txt @@ -0,0 +1,14 @@ +cat file.txt |while read o n + do echo $o $n +done + +ls *.mp4| while read line +do echo $line +echo -e "$line \t $(echo -e $line |sed 's/Word//')" +done + +# Script for making the ummy files +cat list.txt |while read line +do echo $line +touch "$line" +done