Skip to content

Change file names in a bash script

I’m using a simple bash script to copy, via rsync, a series of files and directories from a USB stick to a MacBook. The code is (partially) as follows:

#!/bin/bash
declare -A BACKUP_INFOS
BACKUP_INFOS=(
    [/Users/<username>/Documents]="/Volumes/CORSAIR128/.abook /Volumes/CORSAIR128/.vimrc
     /Volumes/CORSAIR128/argomentare /Volumes/CORSAIR128/articoli /Volumes/CORSAIR128/bibliografie"
)
for dest_dir in "${!BACKUP_INFOS[@]}"
do
  mkdir -p "$dest_dir"
  src="${BACKUP_INFOS[$dest_dir]}"
  rsync -avuz --delete --delete-after --progress $src "$dest_dir"
done

Now, my goal is to modify the names of a source directory (/.abook/) and a source file (..bashrc) so that they are renamed when copying, so they are no longer “hidden.”
What other code should I add?
Thanks