Added all
This commit is contained in:
7
replace_remove/fix-all-special-characters.sh
Executable file
7
replace_remove/fix-all-special-characters.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
./remove_parentheses_files_folders.sh $1
|
||||
./replace_hyphen_with_underscores.sh $1
|
||||
./replace_spaces_with_underscores.sh $1
|
||||
./replace_under_hyphen_under_with_underscores.sh $1
|
||||
./replace_triple_with_underscores.sh $1
|
||||
23
replace_remove/remove_parentheses_files_folders.sh
Executable file
23
replace_remove/remove_parentheses_files_folders.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to rename files and folders recursively
|
||||
rename_files_and_folders() {
|
||||
find "$1" -depth | while read -r item; do
|
||||
# Remove parentheses from names
|
||||
new_item=$(echo "$item" | sed 's/[()]//g')
|
||||
|
||||
# Rename item if the new name is different
|
||||
if [ "$item" != "$new_item" ]; then
|
||||
mv "$item" "$new_item"
|
||||
echo "Renamed: $item -> $new_item"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Starting directory (default is current directory if no argument is provided)
|
||||
start_dir="${1:-.}"
|
||||
|
||||
echo "Starting from directory: $start_dir"
|
||||
rename_files_and_folders "$start_dir"
|
||||
|
||||
echo "Done!"
|
||||
23
replace_remove/remove_parentheses_folders.sh
Executable file
23
replace_remove/remove_parentheses_folders.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to rename folders recursively
|
||||
rename_folders() {
|
||||
find "$1" -depth -type d | while read -r dir; do
|
||||
# Remove parentheses from folder names
|
||||
new_dir=$(echo "$dir" | sed 's/[()]//g')
|
||||
|
||||
# Rename folder if the new name is different
|
||||
if [ "$dir" != "$new_dir" ]; then
|
||||
mv "$dir" "$new_dir"
|
||||
echo "Renamed: $dir -> $new_dir"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Starting directory (default is current directory if no argument is provided)
|
||||
start_dir="${1:-.}"
|
||||
|
||||
echo "Starting from directory: $start_dir"
|
||||
rename_folders "$start_dir"
|
||||
|
||||
echo "Done!"
|
||||
23
replace_remove/replace_hyphen_with_underscores.sh
Executable file
23
replace_remove/replace_hyphen_with_underscores.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to rename files and folders recursively
|
||||
replace_spaces_with_underscores() {
|
||||
find "$1" -depth | while read -r item; do
|
||||
# Replace spaces with underscores in names
|
||||
new_item=$(echo "$item" | sed 's/-/_/g')
|
||||
|
||||
# Rename item if the new name is different
|
||||
if [ "$item" != "$new_item" ]; then
|
||||
mv "$item" "$new_item"
|
||||
echo "Renamed: $item -> $new_item"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Starting directory (default is current directory if no argument is provided)
|
||||
start_dir="${1:-.}"
|
||||
|
||||
echo "Starting from directory: $start_dir"
|
||||
replace_spaces_with_underscores "$start_dir"
|
||||
|
||||
echo "Done!"
|
||||
23
replace_remove/replace_spaces_with_underscores.sh
Executable file
23
replace_remove/replace_spaces_with_underscores.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to rename files and folders recursively
|
||||
replace_spaces_with_underscores() {
|
||||
find "$1" -depth | while read -r item; do
|
||||
# Replace spaces with underscores in names
|
||||
new_item=$(echo "$item" | sed 's/ /_/g')
|
||||
|
||||
# Rename item if the new name is different
|
||||
if [ "$item" != "$new_item" ]; then
|
||||
mv "$item" "$new_item"
|
||||
echo "Renamed: $item -> $new_item"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Starting directory (default is current directory if no argument is provided)
|
||||
start_dir="${1:-.}"
|
||||
|
||||
echo "Starting from directory: $start_dir"
|
||||
replace_spaces_with_underscores "$start_dir"
|
||||
|
||||
echo "Done!"
|
||||
23
replace_remove/replace_triple_with_underscores.sh
Executable file
23
replace_remove/replace_triple_with_underscores.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to rename files and folders recursively
|
||||
replace_spaces_with_underscores() {
|
||||
find "$1" -depth | while read -r item; do
|
||||
# Replace spaces with underscores in names
|
||||
new_item=$(echo "$item" | sed 's/___/_/g')
|
||||
|
||||
# Rename item if the new name is different
|
||||
if [ "$item" != "$new_item" ]; then
|
||||
mv "$item" "$new_item"
|
||||
echo "Renamed: $item -> $new_item"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Starting directory (default is current directory if no argument is provided)
|
||||
start_dir="${1:-.}"
|
||||
|
||||
echo "Starting from directory: $start_dir"
|
||||
replace_spaces_with_underscores "$start_dir"
|
||||
|
||||
echo "Done!"
|
||||
23
replace_remove/replace_under_hyphen_under_with_underscores.sh
Executable file
23
replace_remove/replace_under_hyphen_under_with_underscores.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to rename files and folders recursively
|
||||
replace_spaces_with_underscores() {
|
||||
find "$1" -depth | while read -r item; do
|
||||
# Replace spaces with underscores in names
|
||||
new_item=$(echo "$item" | sed 's/_-_/_/g')
|
||||
|
||||
# Rename item if the new name is different
|
||||
if [ "$item" != "$new_item" ]; then
|
||||
mv "$item" "$new_item"
|
||||
echo "Renamed: $item -> $new_item"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Starting directory (default is current directory if no argument is provided)
|
||||
start_dir="${1:-.}"
|
||||
|
||||
echo "Starting from directory: $start_dir"
|
||||
replace_spaces_with_underscores "$start_dir"
|
||||
|
||||
echo "Done!"
|
||||
Reference in New Issue
Block a user