Skip to content

Commit

Permalink
Merge pull request #1 from 2bitninja/AddMenu
Browse files Browse the repository at this point in the history
Script is now functional
  • Loading branch information
2bitninja committed Oct 10, 2023
2 parents afe4faf + ad952f5 commit cf7664e
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 17 deletions.
Empty file added
Empty file.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test-dir
8 changes: 8 additions & 0 deletions DummyFileCreater.sh
Original file line number Diff line number Diff line change
@@ -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
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```
13 changes: 13 additions & 0 deletions list.txt
Original file line number Diff line number Diff line change
@@ -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
8 changes: 6 additions & 2 deletions mass_rename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/<username>/Dowloads/$(echo -e "$line" |sed -e 's///' -e 's///' )"
#mv "$line" "/Users/<username>/Dowloads/$(echo -e "$line" |sed -e 's/$remove/$add/' -e 's///' )"
50 changes: 50 additions & 0 deletions mass_rename.sh.bk
Original file line number Diff line number Diff line change
@@ -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/<username>/Dowloads/$(echo -e "$line" |sed -e 's///' -e 's///' )"

while true
do
PDIR
done
14 changes: 14 additions & 0 deletions notes.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cf7664e

Please sign in to comment.