Shell scripts that perform some main functions

Script Rclone-AIO

I created a script that performs functions such as copying, synchronizing, moving, removing files and directories, as well as the cleannup function

The same Supports passing extra flags in each command as well as filter file

Script Rename

Here is another script for mass movement renaming where all you need is to create 2 files, one with the old file names and the other with the new names.

#!/bin/bash

# Check if the correct number of arguments was provided
if [ $# -ne 4 ]; then
    echo "Usage: $0 <old_directory> <new_directory> <old_names_list> <new_names_list>"
    exit 1
fi

# Assign the arguments to the corresponding variables
dir_old="$1"
dir_new="$2"
old_names_file="$3"
new_names_file="$4"

# Read the lists of file names
readarray -t old_names < "$old_names_file"
readarray -t new_names < "$new_names_file"

# Check if both lists have the same number of lines
if [ ${#old_names[@]} -ne ${#new_names[@]} ]; then
    echo "The lists of file names do not have the same number of lines."
    exit 1
fi

# Iterate through each old file name
for index in ${!old_names[*]}; do
    old_name="${old_names[$index]}"
    new_name="${new_names[$index]}"

    # Use the rclone command to move and rename the file
    rclone moveto "$dir_old/$old_name" "$dir_new/$new_name"
done

Use

./rclone-rename.sh "remote One:" "remote One:" /path/to/file-old /path/to/file-new