To show a progress bar while copying files with rsync, you can use the --progress option.
The --progress option causes rsync to display a progress bar with information about the transferred files, including the filename, file size, and percentage complete.
For example, to show a progress bar while copying files from the /src directory to the /dst directory:
rsync --progress /src/ /dst/
This will show a progress bar with the transferred files and their progress as rsync copies them from the /src directory to the /dst directory.
To show a progress bar while copying files in a script, you can use the --progress option in a rsync command:
rsync --progress /src/ /dst/ echo "Files copied successfully"
This will show a progress bar while rsync copies the files and print a message when the copy is complete.
Keep in mind that the --progress option may not work with all rsync versions or configurations. You should also regularly review and update the script to ensure that it is correct and efficient.