E-mail : support@tech2now.in

how to copy the file with source and destination using shells script

Linux Linux command ls pwd cp mv more grep tail

Steps to copy the file from source and destination comparison

Create the script with backup.sh

#!/bin/bash

current_files=$(ls)
destination_files=$(ls “$destination_folder”)

for file in $current_files; do

if [[ -f “$destination_folder/$file” ]]; then

mv “$destination_folder/$file” “$backup_folder”

fi

done

Save the script :wq

Change the permission $ chmod 755 backup.sh